diff options
author | tsepez <tsepez@chromium.org> | 2016-05-25 14:58:09 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-25 14:58:09 -0700 |
commit | 1e2c557e0fa0e47c8bafdb31c833ea4f90f5fedd (patch) | |
tree | 86c90cdb10f3c478570934816a56070ed6d51260 /core/fpdfapi/fpdf_page | |
parent | edfd3c3d6a56bee2456e96df4b945c095ea3a290 (diff) | |
download | pdfium-1e2c557e0fa0e47c8bafdb31c833ea4f90f5fedd.tar.xz |
Remove CFX_PrivateData from CPDF_Page
CFX_PrivateData served two purposes here:
The first was to hold an opaque pointer to the corresponding
page structure in the next higher layer, of which it knows
no details. Introduce an empty CPDF_Page::View class to
represent this higher class, so as to get type safety while
preserving layering.
The second was to hold an opaque render context, which it
also happened to own. Make this a CFX_Deletable to help
with management.
Also remove an unused inheritance from CFX_PrivateData
in CPDF_Annot.
Review-Url: https://codereview.chromium.org/2008553008
Diffstat (limited to 'core/fpdfapi/fpdf_page')
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_page.cpp | 1 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_page.h | 14 |
2 files changed, 14 insertions, 1 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_page.cpp b/core/fpdfapi/fpdf_page/cpdf_page.cpp index 6b0609ff00..441bbfe28b 100644 --- a/core/fpdfapi/fpdf_page/cpdf_page.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_page.cpp @@ -21,6 +21,7 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument, bool bPageCache) : m_PageWidth(100), m_PageHeight(100), + m_pView(nullptr), m_pPageRender(bPageCache ? new CPDF_PageRenderCache(this) : nullptr) { m_pFormDict = pPageDict; m_pDocument = pDocument; diff --git a/core/fpdfapi/fpdf_page/include/cpdf_page.h b/core/fpdfapi/fpdf_page/include/cpdf_page.h index 7f4430187a..99734889af 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_page.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_page.h @@ -19,8 +19,10 @@ class CPDF_Document; class CPDF_Object; class CPDF_PageRenderCache; -class CPDF_Page : public CPDF_PageObjectHolder, public CFX_PrivateData { +class CPDF_Page : public CPDF_PageObjectHolder { public: + class View {}; // Caller implements as desired, empty here due to layering. + CPDF_Page(CPDF_Document* pDocument, CPDF_Dictionary* pPageDict, bool bPageCache); @@ -42,6 +44,14 @@ class CPDF_Page : public CPDF_PageObjectHolder, public CFX_PrivateData { CPDF_Object* GetPageAttr(const CFX_ByteString& name) const; CPDF_PageRenderCache* GetRenderCache() const { return m_pPageRender.get(); } + CFX_Deletable* GetRenderContext() const { return m_pRenderContext.get(); } + void SetRenderContext(std::unique_ptr<CFX_Deletable> pContext) { + m_pRenderContext = std::move(pContext); + } + + View* GetView() const { return m_pView; } + void SetView(View* pView) { m_pView = pView; } + protected: friend class CPDF_ContentParser; @@ -50,7 +60,9 @@ class CPDF_Page : public CPDF_PageObjectHolder, public CFX_PrivateData { FX_FLOAT m_PageWidth; FX_FLOAT m_PageHeight; CFX_Matrix m_PageMatrix; + View* m_pView; std::unique_ptr<CPDF_PageRenderCache> m_pPageRender; + std::unique_ptr<CFX_Deletable> m_pRenderContext; }; #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_PAGE_H_ |