summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-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();
}