From c220e59f36a1a5664fc795c801968083adda1722 Mon Sep 17 00:00:00 2001 From: caryclark Date: Mon, 4 Apr 2016 12:48:22 -0700 Subject: flip sense of alpha masks One bit bitmaps may be black and white or may be alpha masks. Treat alpha masks as transparent/opaque instead of black/white. R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1858613003 --- core/fxge/skia/fx_skia_device.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp index e61dda68d4..86d71d485b 100644 --- a/core/fxge/skia/fx_skia_device.cpp +++ b/core/fxge/skia/fx_skia_device.cpp @@ -629,6 +629,8 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int rowBytes = pSource->GetPitch(); switch (pSource->GetBPP()) { case 1: { + uint8_t zero = pSource->IsAlphaMask() ? 0xFF : 0x00; + uint8_t one = zero ^ 0xFF; dst8Storage.reset(FX_Alloc2D(uint8_t, width, height)); uint8_t* dst8Pixels = dst8Storage.get(); for (int y = 0; y < height; ++y) { @@ -636,7 +638,7 @@ FX_BOOL CFX_SkiaDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, static_cast(buffer) + y * rowBytes; uint8_t* dstRow = dst8Pixels + y * width; for (int x = 0; x < width; ++x) - dstRow[x] = srcRow[x >> 3] & (1 << (~x & 0x07)) ? 0xFF : 0x00; + dstRow[x] = srcRow[x >> 3] & (1 << (~x & 0x07)) ? one : zero; } buffer = dst8Storage.get(); rowBytes = width; -- cgit v1.2.3