Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Unified Diff: core/fpdfapi/render/fpdf_render_cache.cpp

Issue 2536903004: Do not clone in CPDF_ImageCacheEntry::GetCachedBitmap (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/render/fpdf_render_cache.cpp
diff --git a/core/fpdfapi/render/fpdf_render_cache.cpp b/core/fpdfapi/render/fpdf_render_cache.cpp
index 9f663525ec738359397f431b209fef681853a95a..d675ce024edcb5f324346cc2181446c06ba7849d 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698