summaryrefslogtreecommitdiff
path: root/core/fpdfapi/render
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2017-03-06 15:54:38 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-03-07 00:54:49 +0000
commit1704350a92234b1e38f0a84010ddf9ecdfce48f8 (patch)
treefe25c94d6bfc956046bdd25e41333741efb9e5d3 /core/fpdfapi/render
parentf9e67832df93d5a8df6546144e38ced023212d37 (diff)
downloadpdfium-1704350a92234b1e38f0a84010ddf9ecdfce48f8.tar.xz
Manual revert of: Avoid cloning in CPDF_ImageCacheEntry::ContinueGetCachedBitmap
Not cloning is causing issues when printing to XPS printer. I have no idea why. CL being reverted: https://codereview.chromium.org/2518063005/ BUG=698350 Change-Id: I7c814c712f9959d10d0b6502a28e15ecd752f94a Reviewed-on: https://pdfium-review.googlesource.com/2930 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi/render')
-rw-r--r--core/fpdfapi/render/cpdf_imagecacheentry.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/core/fpdfapi/render/cpdf_imagecacheentry.cpp
index f11cae888d..82b6117f86 100644
--- a/core/fpdfapi/render/cpdf_imagecacheentry.cpp
+++ b/core/fpdfapi/render/cpdf_imagecacheentry.cpp
@@ -97,11 +97,21 @@ void CPDF_ImageCacheEntry::ContinueGetCachedBitmap() {
CPDF_RenderContext* pContext = m_pRenderStatus->GetContext();
CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache();
m_dwTimeCount = pPageRenderCache->GetTimeCount();
- m_pCachedBitmap = pdfium::WrapUnique<CFX_DIBSource>(m_pCurBitmap);
- if (m_pCurMask)
- m_pCachedMask = pdfium::WrapUnique<CFX_DIBSource>(m_pCurMask);
- else
- m_pCurMask = m_pCachedMask.get();
+ if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() <
+ FPDF_HUGE_IMAGE_SIZE) {
+ m_pCachedBitmap = m_pCurBitmap->Clone();
+ delete m_pCurBitmap;
+ m_pCurBitmap = nullptr;
+ } else {
+ m_pCachedBitmap = pdfium::WrapUnique<CFX_DIBSource>(m_pCurBitmap);
+ }
+ if (m_pCurMask) {
+ m_pCachedMask = m_pCurMask->Clone();
+ delete m_pCurMask;
+ m_pCurMask = nullptr;
+ }
+ m_pCurBitmap = m_pCachedBitmap.get();
+ m_pCurMask = m_pCachedMask.get();
CalcSize();
}