summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_streamcontentparser.cpp
diff options
context:
space:
mode:
authorrbpotter <rbpotter@chromium.org>2017-04-17 09:10:21 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-18 00:26:02 +0000
commitcec01808e8b155f598b2a9ea527736ce774e76a2 (patch)
tree9614ce31345bb73e9d7c1a438c10bb83776599c3 /core/fpdfapi/page/cpdf_streamcontentparser.cpp
parent080dfd89269a95713d31d66829016d4885afe76b (diff)
downloadpdfium-cec01808e8b155f598b2a9ea527736ce774e76a2.tar.xz
Render image masks individually instead of rendering the entire page as
a bitmap in order to reduce spool sizes. BUG=682156, 674771 Change-Id: Ic743ba729a7b9609be18fb620a5eb6bc440aed6a Reviewed-on: https://pdfium-review.googlesource.com/2916 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_streamcontentparser.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 30686133c2..d9f12f121b 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -735,7 +735,11 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
CFX_ByteString name = GetString(0);
if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() &&
m_pLastImage->GetStream()->GetObjNum()) {
- AddImage(m_pLastImage);
+ CPDF_ImageObject* pObj = AddImage(m_pLastImage);
+ // Record the bounding box of this image, so rendering code can draw it
+ // properly.
+ if (pObj->GetImage()->IsMask())
+ m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
return;
}
@@ -757,8 +761,8 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
m_LastImageName = name;
m_pLastImage = pObj->GetImage();
- if (!m_pObjectHolder->HasImageMask())
- m_pObjectHolder->SetHasImageMask(m_pLastImage->IsMask());
+ if (m_pLastImage->IsMask())
+ m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
} else if (type == "Form") {
AddForm(pXObject);
}