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

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

Issue 2518063005: Avoid cloning in CPDF_ImageCacheEntry::ContinueGetCachedBitmap (Closed)
Patch Set: Comment 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 a91d2ba8d03416f95cf6572aef1902215271cb4f..9f663525ec738359397f431b209fef681853a95a 100644
--- a/core/fpdfapi/render/fpdf_render_cache.cpp
+++ b/core/fpdfapi/render/fpdf_render_cache.cpp
@@ -292,29 +292,21 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources,
ContinueGetCachedBitmap();
return 0;
}
+
void CPDF_ImageCacheEntry::ContinueGetCachedBitmap() {
m_MatteColor = ((CPDF_DIBSource*)m_pCurBitmap)->GetMatteColor();
m_pCurMask = ((CPDF_DIBSource*)m_pCurBitmap)->DetachMask();
CPDF_RenderContext* pContext = m_pRenderStatus->GetContext();
CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache();
m_dwTimeCount = pPageRenderCache->GetTimeCount();
- 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 = m_pCurBitmap;
- }
- if (m_pCurMask) {
- m_pCachedMask = m_pCurMask->Clone();
- delete m_pCurMask;
- m_pCurMask = nullptr;
- }
- m_pCurBitmap = m_pCachedBitmap;
- m_pCurMask = m_pCachedMask;
+ m_pCachedBitmap = m_pCurBitmap;
+ if (m_pCurMask)
+ m_pCachedMask = m_pCurMask;
+ else
+ m_pCurMask = m_pCachedMask;
CalcSize();
}
+
int CPDF_ImageCacheEntry::Continue(IFX_Pause* pPause) {
int ret = ((CPDF_DIBSource*)m_pCurBitmap)->ContinueLoadDIBSource(pPause);
if (ret == 2) {
« 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