summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp5
-rw-r--r--core/fpdfapi/page/cpdf_image.h2
-rw-r--r--core/fpdfapi/render/cpdf_pagerendercache.cpp17
-rw-r--r--core/fpdfapi/render/cpdf_pagerendercache.h4
4 files changed, 10 insertions, 18 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;