summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authorcaryclark <caryclark@google.com>2016-04-04 12:48:22 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-04 12:48:22 -0700
commitc220e59f36a1a5664fc795c801968083adda1722 (patch)
treeb0865f0cbf7701551585b5e2e8fa5944a1cd14e6 /core/fxge
parentf8a5ef3056619c1a8e7d1108ac3720c97ca8e67d (diff)
downloadpdfium-c220e59f36a1a5664fc795c801968083adda1722.tar.xz
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
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/skia/fx_skia_device.cpp4
1 files changed, 3 insertions, 1 deletions
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<const uint8_t*>(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;