diff options
-rw-r--r-- | core/fpdfapi/page/cpdf_image.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_image.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_pagerendercache.cpp | 17 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_pagerendercache.h | 4 | ||||
-rw-r--r-- | fpdfsdk/fpdf_editimg.cpp | 4 |
5 files changed, 12 insertions, 20 deletions
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp index f7eec131ad..d618b737be 100644 --- a/core/fpdfapi/page/cpdf_image.cpp +++ b/core/fpdfapi/page/cpdf_image.cpp @@ -334,10 +334,9 @@ void CPDF_Image::SetImage(const RetainPtr<CFX_DIBitmap>& pBitmap) { FX_Free(dest_buf); } -void CPDF_Image::ResetCache(CPDF_Page* pPage, - const RetainPtr<CFX_DIBitmap>& pBitmap) { +void CPDF_Image::ResetCache(CPDF_Page* pPage) { RetainPtr<CPDF_Image> pHolder(this); - pPage->GetRenderCache()->ResetBitmap(pHolder, pBitmap); + pPage->GetRenderCache()->ResetBitmap(pHolder); } RetainPtr<CFX_DIBBase> CPDF_Image::LoadDIBBase() const { diff --git a/core/fpdfapi/page/cpdf_image.h b/core/fpdfapi/page/cpdf_image.h index b4636711fd..744793aece 100644 --- a/core/fpdfapi/page/cpdf_image.h +++ b/core/fpdfapi/page/cpdf_image.h @@ -51,7 +51,7 @@ class CPDF_Image final : public Retainable { void SetJpegImage(const RetainPtr<IFX_SeekableReadStream>& pFile); void SetJpegImageInline(const RetainPtr<IFX_SeekableReadStream>& pFile); - void ResetCache(CPDF_Page* pPage, const RetainPtr<CFX_DIBitmap>& pDIBitmap); + void ResetCache(CPDF_Page* pPage); // Returns whether to Continue() or not. bool StartLoadDIBBase(const CPDF_Dictionary* pFormResource, diff --git a/core/fpdfapi/render/cpdf_pagerendercache.cpp b/core/fpdfapi/render/cpdf_pagerendercache.cpp index 61602d36f0..dfd05bc494 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.cpp +++ b/core/fpdfapi/render/cpdf_pagerendercache.cpp @@ -13,6 +13,7 @@ #include "core/fpdfapi/page/cpdf_page.h" #include "core/fpdfapi/render/cpdf_imagecacheentry.h" #include "core/fpdfapi/render/cpdf_renderstatus.h" +#include "core/fxge/dib/cfx_dibitmap.h" namespace { @@ -125,21 +126,15 @@ bool CPDF_PageRenderCache::Continue(PauseIndicatorIface* pPause, return false; } -void CPDF_PageRenderCache::ResetBitmap(const RetainPtr<CPDF_Image>& pImage, - const RetainPtr<CFX_DIBitmap>& pBitmap) { +void CPDF_PageRenderCache::ResetBitmap(const RetainPtr<CPDF_Image>& pImage) { CPDF_ImageCacheEntry* pEntry; CPDF_Stream* pStream = pImage->GetStream(); const auto it = m_ImageCache.find(pStream); - if (it == m_ImageCache.end()) { - if (!pBitmap) - return; + if (it == m_ImageCache.end()) + return; - pEntry = new CPDF_ImageCacheEntry(m_pPage->GetDocument(), pImage); - m_ImageCache[pStream] = pEntry; - } else { - pEntry = it->second; - } + pEntry = it->second; m_nCacheSize -= pEntry->EstimateSize(); - pEntry->Reset(pBitmap); + pEntry->Reset(nullptr); m_nCacheSize += pEntry->EstimateSize(); } diff --git a/core/fpdfapi/render/cpdf_pagerendercache.h b/core/fpdfapi/render/cpdf_pagerendercache.h index fe94bed722..8f0cb59414 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.h +++ b/core/fpdfapi/render/cpdf_pagerendercache.h @@ -13,7 +13,6 @@ #include "core/fxcrt/retain_ptr.h" #include "core/fxcrt/unowned_ptr.h" -class CFX_DIBitmap; class CPDF_Image; class CPDF_ImageCacheEntry; class CPDF_Page; @@ -28,8 +27,7 @@ class CPDF_PageRenderCache { void CacheOptimization(int32_t dwLimitCacheSize); uint32_t GetTimeCount() const { return m_nTimeCount; } - void ResetBitmap(const RetainPtr<CPDF_Image>& pImage, - const RetainPtr<CFX_DIBitmap>& pBitmap); + void ResetBitmap(const RetainPtr<CPDF_Image>& pImage); CPDF_Page* GetPage() const { return m_pPage.Get(); } CPDF_ImageCacheEntry* GetCurImageCacheEntry() const { return m_pCurImageCacheEntry; diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp index 3709da7d2e..a062990afe 100644 --- a/fpdfsdk/fpdf_editimg.cpp +++ b/fpdfsdk/fpdf_editimg.cpp @@ -67,7 +67,7 @@ bool LoadJpegHelper(FPDF_PAGE* pages, for (int index = 0; index < nCount; index++) { CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); if (pPage) - pImgObj->GetImage()->ResetCache(pPage, nullptr); + pImgObj->GetImage()->ResetCache(pPage); } } @@ -151,7 +151,7 @@ FPDFImageObj_SetBitmap(FPDF_PAGE* pages, for (int index = 0; index < nCount; index++) { CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]); if (pPage) - pImgObj->GetImage()->ResetCache(pPage, nullptr); + pImgObj->GetImage()->ResetCache(pPage); } RetainPtr<CFX_DIBitmap> holder(CFXDIBitmapFromFPDFBitmap(bitmap)); pImgObj->GetImage()->SetImage(holder); |