diff options
author | npm <npm@chromium.org> | 2016-11-29 10:10:31 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-29 10:10:32 -0800 |
commit | 708ef623c2e989a9ad909bf0c94a7dff89694412 (patch) | |
tree | d8f2ca9dbe556555eaaf885465054f1fdfd4fc6c | |
parent | 05e01698444726fae302cd335fa4880932d7c543 (diff) | |
download | pdfium-708ef623c2e989a9ad909bf0c94a7dff89694412.tar.xz |
Do not clone in CPDF_ImageCacheEntry::GetCachedBitmap
Review-Url: https://codereview.chromium.org/2536903004
-rw-r--r-- | core/fpdfapi/render/fpdf_render_cache.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
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; |