summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJun Fang <jun_fang@foxitsoftware.com>2015-12-29 10:27:44 +0800
committerJun Fang <jun_fang@foxitsoftware.com>2015-12-29 10:27:44 +0800
commit1aeeceb45d785fc9cfbc69510220655fdcc9dd63 (patch)
tree0eb8920e2414868eaa23fe7c6c35637fe33ffa43
parent14da3986ba7406dc973f15f15d62ee41490b725e (diff)
downloadpdfium-1aeeceb45d785fc9cfbc69510220655fdcc9dd63.tar.xz
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 .
-rw-r--r--core/include/fpdfapi/fpdf_page.h3
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp2
-rw-r--r--fpdfsdk/src/fpdfview.cpp21
4 files changed, 17 insertions, 10 deletions
diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h
index efbfa67280..d58537aa7e 100644
--- a/core/include/fpdfapi/fpdf_page.h
+++ b/core/include/fpdfapi/fpdf_page.h
@@ -67,6 +67,8 @@ class CPDF_PageObjects {
FX_BOOL BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; }
+ FX_BOOL HasImageMask() const { return m_bHasImageMask; }
+
CFX_FloatRect CalcBoundingBox() const;
CPDF_Dictionary* m_pFormDict;
@@ -89,6 +91,7 @@ class CPDF_PageObjects {
CFX_PtrList m_ObjectList;
FX_BOOL m_bBackgroundAlphaNeeded;
+ FX_BOOL m_bHasImageMask;
FX_BOOL m_bReleaseMembers;
CPDF_ContentParser* m_pParser;
ParseState m_ParseState;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index 1fef74b99b..7e2492fad7 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -675,6 +675,7 @@ CPDF_PageObjects::CPDF_PageObjects(FX_BOOL bReleaseMembers)
m_Transparency(0),
m_ObjectList(128),
m_bBackgroundAlphaNeeded(FALSE),
+ m_bHasImageMask(FALSE),
m_bReleaseMembers(bReleaseMembers),
m_pParser(nullptr),
m_ParseState(CONTENT_NOT_PARSED) {}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 865c6b7116..264b6fb36f 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -710,6 +710,8 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
CPDF_ImageObject* pObj = AddImage(pXObject, NULL, FALSE);
m_LastImageName = name;
m_pLastImage = pObj->m_pImage;
+ if (!m_pObjectList->m_bHasImageMask)
+ m_pObjectList->m_bHasImageMask = m_pLastImage->IsMask();
} else if (type == "Form") {
AddForm(pXObject);
} else {
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);
}