summaryrefslogtreecommitdiff
path: root/core/src/fxge/win32
diff options
context:
space:
mode:
authorBo Xu <bo_xu@foxitsoftware.com>2014-11-10 13:34:05 -0800
committerBo Xu <bo_xu@foxitsoftware.com>2014-11-10 13:43:06 -0800
commit83dea75eacaaf64349b4aa7eac47f0864bfba491 (patch)
tree6967ea89644c651c4f5f57cce8e39130689b4eac /core/src/fxge/win32
parent35e6b87afbb94e2a74340a5e8fd77e79e88f6025 (diff)
downloadpdfium-83dea75eacaaf64349b4aa7eac47f0864bfba491.tar.xz
Merge to XFA: patch from CL 618073003
BUG=401988 R=vitalybuka@chromium.org Review URL: https://codereview.chromium.org/618073003
Diffstat (limited to 'core/src/fxge/win32')
-rw-r--r--core/src/fxge/win32/fx_win32_device.cpp28
1 files changed, 26 insertions, 2 deletions
diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp
index eee4fd8285..d82102462a 100644
--- a/core/src/fxge/win32/fx_win32_device.cpp
+++ b/core/src/fxge/win32/fx_win32_device.cpp
@@ -570,8 +570,32 @@ FX_BOOL CGdiDeviceDriver::GDI_StretchBitMask(const CFX_DIBitmap* pBitmap1, int d
}
bmi.bmiColors[0] = 0xffffff;
bmi.bmiColors[1] = 0;
- ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height,
- 0, 0, width, height, pBitmap->GetBuffer(), (BITMAPINFO*)&bmi, DIB_RGB_COLORS, SRCAND);
+
+ HBRUSH hPattern = CreateSolidBrush(bitmap_color & 0xffffff);
+ HBRUSH hOld = (HBRUSH)SelectObject(m_hDC, hPattern);
+
+
+ // In PDF, when image mask is 1, use device bitmap; when mask is 0, use brush bitmap.
+ // A complete list of the boolen operations is as follows:
+
+ /* P(bitmap_color) S(ImageMask) D(DeviceBitmap) Result
+ * 0 0 0 0
+ * 0 0 1 0
+ * 0 1 0 0
+ * 0 1 1 1
+ * 1 0 0 1
+ * 1 0 1 1
+ * 1 1 0 0
+ * 1 1 1 1
+ */
+ // The boolen codes is B8. Based on http://msdn.microsoft.com/en-us/library/aa932106.aspx, the ROP3 code is 0xB8074A
+
+ ::StretchDIBits(m_hDC, dest_left, dest_top, dest_width, dest_height,
+ 0, 0, width, height, pBitmap->GetBuffer(), (BITMAPINFO*)&bmi, DIB_RGB_COLORS, 0xB8074A);
+
+ SelectObject(m_hDC, hOld);
+ DeleteObject(hPattern);
+
return TRUE;
}
BOOL CGdiDeviceDriver::GetClipBox(FX_RECT* pRect)