From 1aeeceb45d785fc9cfbc69510220655fdcc9dd63 Mon Sep 17 00:00:00 2001 From: Jun Fang Date: Tue, 29 Dec 2015 10:27:44 +0800 Subject: Merge to XFA: Fix partial information printed with blank window covering the center BUG=482206 R=thestig@chromium.org Review URL: https://codereview.chromium.org/1551563002 . Review URL: https://codereview.chromium.org/1552643002 . --- fpdfsdk/src/fpdfview.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index cca56e33fb..1c8dcc22f2 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -533,10 +533,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); @@ -547,13 +547,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); @@ -566,8 +567,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 @@ -668,10 +670,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); } -- cgit v1.2.3