[Libreoffice-commits] core.git: vcl/headless
Caolán McNamara
caolanm at redhat.com
Mon Sep 4 15:22:50 UTC 2017
vcl/headless/svpgdi.cxx | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
New commits:
commit 3cb59bff332b02f607d15b5ed41b4438e8102980
Author: Caolán McNamara <caolanm at redhat.com>
Date: Mon Sep 4 13:34:09 2017 +0100
Resolves: tdf#111483 1 bit bitmaps with non-standard black/white indexes
can be left "untoggled" when converted to cairo A1
Change-Id: I18f3e2109cd4b57bce584545090e26c931de1200
Reviewed-on: https://gerrit.libreoffice.org/41895
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx
index ce01c4e89230..170d6c6087e6 100644
--- a/vcl/headless/svpgdi.cxx
+++ b/vcl/headless/svpgdi.cxx
@@ -113,6 +113,7 @@ namespace
void Toggle1BitTransparency(const BitmapBuffer& rBuf)
{
+ assert(rBuf.maPalette.GetBestIndex(BitmapColor(Color(COL_BLACK))) == 0);
// TODO: make upper layers use standard alpha
if (getCairoFormat(rBuf) == CAIRO_FORMAT_A1)
{
@@ -216,10 +217,14 @@ namespace
pAlphaBits.reset( new unsigned char[nImageSize] );
memcpy(pAlphaBits.get(), pMaskBuf->mpBits, nImageSize);
- // TODO: make upper layers use standard alpha
- unsigned char* pDst = pAlphaBits.get();
- for (int i = nImageSize; --i >= 0; ++pDst)
- *pDst = ~*pDst;
+ const sal_Int32 nBlackIndex = pMaskBuf->maPalette.GetBestIndex(BitmapColor(Color(COL_BLACK)));
+ if (nBlackIndex == 0)
+ {
+ // TODO: make upper layers use standard alpha
+ unsigned char* pDst = pAlphaBits.get();
+ for (int i = nImageSize; --i >= 0; ++pDst)
+ *pDst = ~*pDst;
+ }
mask = cairo_image_surface_create_for_data(pAlphaBits.get(),
CAIRO_FORMAT_A1,
More information about the Libreoffice-commits
mailing list