summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-12-29 10:18:43 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-12-29 10:18:43 +0800
commit8be8a4452a947ce125dd1feea00cc9fd23714ec6 (patch)
tree27113413aeed27d481236e645b1abb58c969b7f0 /fpdfsdk/src
parent1134cc9f56c85d13ec14eaa78726ef02121cb18c (diff)
downloadpdfium-8be8a4452a947ce125dd1feea00cc9fd23714ec6.tar.xz
Fix partial information printed with blank window covering the centerchromium/2612chromium/2611chromium/2610chromium/2609chromium/2608chromium/2607
BUG=482206 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1551563002 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdfview.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 1e1eb2a845..041adda21f 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -336,10 +336,10 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
pPage->SetPrivateData((void*)1, pContext, DropContext);
#ifndef _WIN32_WCE
- CFX_DIBitmap* pBitmap = NULL;
- FX_BOOL bBackgroundAlphaNeeded = FALSE;
- bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded();
- if (bBackgroundAlphaNeeded) {
+ CFX_DIBitmap* pBitmap = nullptr;
+ FX_BOOL bBackgroundAlphaNeeded = pPage->BackgroundAlphaNeeded();
+ FX_BOOL bHasImageMask = pPage->HasImageMask();
+ if (bBackgroundAlphaNeeded || bHasImageMask) {
pBitmap = new CFX_DIBitmap;
pBitmap->Create(size_x, size_y, FXDIB_Argb);
pBitmap->Clear(0x00ffffff);
@@ -350,13 +350,14 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
pContext->m_pDevice = new CFX_FxgeDevice;
((CFX_FxgeDevice*)pContext->m_pDevice)->Attach((CFX_DIBitmap*)pBitmap);
#endif
- } else
+ } else {
pContext->m_pDevice = new CFX_WindowsDevice(dc);
+ }
FPDF_RenderPage_Retail(pContext, page, start_x, start_y, size_x, size_y,
rotate, flags, TRUE, NULL);
- if (bBackgroundAlphaNeeded) {
+ if (bBackgroundAlphaNeeded || bHasImageMask) {
if (pBitmap) {
CFX_WindowsDevice WinDC(dc);
@@ -369,8 +370,9 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
FXDIB_BLEND_NORMAL, NULL, FALSE, NULL);
WinDC.StretchDIBits(pDst, 0, 0, size_x, size_y);
delete pDst;
- } else
+ } else {
WinDC.SetDIBits(pBitmap, 0, 0);
+ }
}
}
#else
@@ -471,10 +473,9 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc,
#endif
#endif
- if (bBackgroundAlphaNeeded) {
+ if (bBackgroundAlphaNeeded || bHasImageMask)
delete pBitmap;
- pBitmap = NULL;
- }
+
delete pContext;
pPage->RemovePrivateData((void*)1);
}