From 708ef623c2e989a9ad909bf0c94a7dff89694412 Mon Sep 17 00:00:00 2001 From: npm Date: Tue, 29 Nov 2016 10:10:31 -0800 Subject: Do not clone in CPDF_ImageCacheEntry::GetCachedBitmap Review-Url: https://codereview.chromium.org/2536903004 --- core/fpdfapi/render/fpdf_render_cache.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'core') diff --git a/core/fpdfapi/render/fpdf_render_cache.cpp b/core/fpdfapi/render/fpdf_render_cache.cpp index 9f663525ec..d675ce024e 100644 --- a/core/fpdfapi/render/fpdf_render_cache.cpp +++ b/core/fpdfapi/render/fpdf_render_cache.cpp @@ -233,22 +233,16 @@ bool CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, return false; } m_MatteColor = MatteColor; - if (pSrc->GetPitch() * pSrc->GetHeight() < FPDF_HUGE_IMAGE_SIZE) { - m_pCachedBitmap = pSrc->Clone(); - delete pSrc; - } else { - m_pCachedBitmap = pSrc; - } - if (pMaskSrc) { - m_pCachedMask = pMaskSrc->Clone(); - delete pMaskSrc; - } + m_pCachedBitmap = pSrc; + if (pMaskSrc) + m_pCachedMask = pMaskSrc; pBitmap = m_pCachedBitmap; pMask = m_pCachedMask; CalcSize(); return false; } + CFX_DIBSource* CPDF_ImageCacheEntry::DetachBitmap() { CFX_DIBSource* pDIBSource = m_pCurBitmap; m_pCurBitmap = nullptr; -- cgit v1.2.3