diff options
author | Lei Zhang <thestig@chromium.org> | 2017-08-01 16:20:47 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-02 18:35:18 +0000 |
commit | 4a0cbf9f0cb4f7e3bcbae68f82201b44fc94c231 (patch) | |
tree | df967e2cf308b06cd604af2b4c0f929e8c26a71a /core | |
parent | 61899373fcf97ccbe525b001130bc71d61839498 (diff) | |
download | pdfium-4a0cbf9f0cb4f7e3bcbae68f82201b44fc94c231.tar.xz |
Pass a CPDF_ImageObject* into CPDF_ImageRenderer::Start().
Instead of passing in a CPDF_PageObject* and then converting it to an
image, which is always what it is.
Change-Id: I146a476147f4b344417982b5ace002b9bd7b3d80
Reviewed-on: https://pdfium-review.googlesource.com/9810
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/render/cpdf_imagerenderer.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imagerenderer.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 24 |
3 files changed, 16 insertions, 15 deletions
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index e6280772c8..e04bd0c0f8 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -161,13 +161,14 @@ bool CPDF_ImageRenderer::StartRenderDIBSource() { } bool CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, - CPDF_PageObject* pObj, + CPDF_ImageObject* pImageObject, const CFX_Matrix* pObj2Device, bool bStdCS, int blendType) { + ASSERT(pImageObject); m_pRenderStatus = pStatus; m_bStdCS = bStdCS; - m_pImageObject = pObj->AsImage(); + m_pImageObject = pImageObject; m_BlendType = blendType; m_pObj2Device = pObj2Device; CPDF_Dictionary* pOC = m_pImageObject->GetImage()->GetOC(); diff --git a/core/fpdfapi/render/cpdf_imagerenderer.h b/core/fpdfapi/render/cpdf_imagerenderer.h index 46159284b2..345860107f 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.h +++ b/core/fpdfapi/render/cpdf_imagerenderer.h @@ -29,7 +29,7 @@ class CPDF_ImageRenderer { ~CPDF_ImageRenderer(); bool Start(CPDF_RenderStatus* pStatus, - CPDF_PageObject* pObj, + CPDF_ImageObject* pImageObject, const CFX_Matrix* pObj2Device, bool bStdCS, int blendType); diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index a08650500b..6c5d7bc102 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -1122,20 +1122,20 @@ bool CPDF_RenderStatus::ContinueSingleObject(CPDF_PageObject* pObj, if (ProcessTransparency(pObj, pObj2Device)) return false; - if (pObj->IsImage()) { - m_pImageRenderer = pdfium::MakeUnique<CPDF_ImageRenderer>(); - if (!m_pImageRenderer->Start(this, pObj, pObj2Device, false, - FXDIB_BLEND_NORMAL)) { - if (!m_pImageRenderer->GetResult()) - DrawObjWithBackground(pObj, pObj2Device); - m_pImageRenderer.reset(); - return false; - } - return ContinueSingleObject(pObj, pObj2Device, pPause); + if (!pObj->IsImage()) { + ProcessObjectNoClip(pObj, pObj2Device); + return false; } - ProcessObjectNoClip(pObj, pObj2Device); - return false; + m_pImageRenderer = pdfium::MakeUnique<CPDF_ImageRenderer>(); + if (!m_pImageRenderer->Start(this, pObj->AsImage(), pObj2Device, false, + FXDIB_BLEND_NORMAL)) { + if (!m_pImageRenderer->GetResult()) + DrawObjWithBackground(pObj, pObj2Device); + m_pImageRenderer.reset(); + return false; + } + return ContinueSingleObject(pObj, pObj2Device, pPause); } bool CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, |