summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-18 14:53:31 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-18 14:53:31 -0800
commit0fa6fee0e48af8681f0cd50f6a9471ecc0a46c11 (patch)
tree6e8b93a1103b71c3b83e35bc7308658521b49bde /core/include
parente6ca18ad72a1555e89dc37117c5be220631c5e0c (diff)
downloadpdfium-0fa6fee0e48af8681f0cd50f6a9471ecc0a46c11.tar.xz
Remove CFX_MapPtrToPtr in CFX_PageRenderCache
Rename CPDF_ImageCache to CPDF_ImageCacheEntry because it represents a single entry, not the entire cache itself. Delete unused ClearRenderCache method, and merge cache entry clear() into its dtor. Fix a broken size calculation. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1539983002 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdfapi/fpdf_page.h13
-rw-r--r--core/include/fpdfapi/fpdf_render.h38
2 files changed, 19 insertions, 32 deletions
diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h
index 5fa413d29c..efbfa67280 100644
--- a/core/include/fpdfapi/fpdf_page.h
+++ b/core/include/fpdfapi/fpdf_page.h
@@ -97,7 +97,6 @@ class CPDF_PageObjects {
class CPDF_Page : public CPDF_PageObjects, public CFX_PrivateData {
public:
CPDF_Page();
-
~CPDF_Page();
void Load(CPDF_Document* pDocument,
@@ -105,7 +104,6 @@ class CPDF_Page : public CPDF_PageObjects, public CFX_PrivateData {
FX_BOOL bPageCache = TRUE);
void StartParse(CPDF_ParseOptions* pOptions = NULL, FX_BOOL bReParse = FALSE);
-
void ParseContent(CPDF_ParseOptions* pOptions = NULL,
FX_BOOL bReParse = FALSE);
@@ -117,28 +115,17 @@ class CPDF_Page : public CPDF_PageObjects, public CFX_PrivateData {
int iRotate) const;
FX_FLOAT GetPageWidth() const { return m_PageWidth; }
-
FX_FLOAT GetPageHeight() const { return m_PageHeight; }
-
CFX_FloatRect GetPageBBox() const { return m_BBox; }
-
const CFX_Matrix& GetPageMatrix() const { return m_PageMatrix; }
-
CPDF_Object* GetPageAttr(const CFX_ByteStringC& name) const;
-
CPDF_PageRenderCache* GetRenderCache() const { return m_pPageRender; }
- void ClearRenderCache();
-
protected:
friend class CPDF_ContentParser;
-
FX_FLOAT m_PageWidth;
-
FX_FLOAT m_PageHeight;
-
CFX_Matrix m_PageMatrix;
-
CPDF_PageRenderCache* m_pPageRender;
};
class CPDF_ParseOptions {
diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h
index 9895b6a0fd..245a85d502 100644
--- a/core/include/fpdfapi/fpdf_render.h
+++ b/core/include/fpdfapi/fpdf_render.h
@@ -7,15 +7,17 @@
#ifndef CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_
#define CORE_INCLUDE_FPDFAPI_FPDF_RENDER_H_
+#include <map>
+
+#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fxge/fx_ge.h"
-#include "fpdf_page.h"
#include "third_party/base/nonstd_unique_ptr.h"
class CFX_GraphStateData;
class CFX_PathData;
class CFX_RenderDevice;
class CPDF_FormObject;
-class CPDF_ImageCache;
+class CPDF_ImageCacheEntry;
class CPDF_ImageObject;
class CPDF_PathObject;
class CPDF_RenderContext;
@@ -214,20 +216,17 @@ class CPDF_TextRenderer {
};
class CPDF_PageRenderCache {
public:
- CPDF_PageRenderCache(CPDF_Page* pPage) {
- m_pPage = pPage;
- m_nTimeCount = 0;
- m_nCacheSize = 0;
- m_pCurImageCache = NULL;
- m_bCurFindCache = FALSE;
- }
- ~CPDF_PageRenderCache() { ClearAll(); }
- void ClearAll();
+ explicit CPDF_PageRenderCache(CPDF_Page* pPage)
+ : m_pPage(pPage),
+ m_pCurImageCacheEntry(nullptr),
+ m_nTimeCount(0),
+ m_nCacheSize(0),
+ m_bCurFindCache(FALSE) {}
+ ~CPDF_PageRenderCache();
void ClearImageData();
FX_DWORD EstimateSize();
void CacheOptimization(int32_t dwLimitCacheSize);
- FX_DWORD GetCachedSize(CPDF_Stream* pStream) const;
FX_DWORD GetTimeCount() const { return m_nTimeCount; }
void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; }
@@ -243,11 +242,12 @@ class CPDF_PageRenderCache {
int32_t downsampleHeight = 0);
void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap);
- void ClearImageCache(CPDF_Stream* pStream);
- CPDF_Page* GetPage() { return m_pPage; }
- CFX_MapPtrToPtr m_ImageCaches;
+ void ClearImageCacheEntry(CPDF_Stream* pStream);
+ CPDF_Page* GetPage() const { return m_pPage; }
+ CPDF_ImageCacheEntry* GetCurImageCacheEntry() const {
+ return m_pCurImageCacheEntry;
+ }
- public:
FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream,
FX_BOOL bStdCS = FALSE,
FX_DWORD GroupFamily = 0,
@@ -257,12 +257,12 @@ class CPDF_PageRenderCache {
int32_t downsampleHeight = 0);
FX_BOOL Continue(IFX_Pause* pPause);
- CPDF_ImageCache* m_pCurImageCache;
protected:
friend class CPDF_Page;
- CPDF_Page* m_pPage;
-
+ CPDF_Page* const m_pPage;
+ CPDF_ImageCacheEntry* m_pCurImageCacheEntry;
+ std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache;
FX_DWORD m_nTimeCount;
FX_DWORD m_nCacheSize;
FX_BOOL m_bCurFindCache;