diff options
author | Nicolas Pena <npm@chromium.org> | 2017-02-15 16:26:48 -0500 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-02-15 23:35:50 +0000 |
commit | a4ad01fe03ffdd1806d31a9d7bb820f6a69a0afb (patch) | |
tree | 346da436a6382e1509e84cbdaf1b622035a97f32 /core/fpdfapi/page/cpdf_page.h | |
parent | f7fddc9325da53c861aa4f2a7c0139b39bc1da60 (diff) | |
download | pdfium-a4ad01fe03ffdd1806d31a9d7bb820f6a69a0afb.tar.xz |
Move generated graphics and font maps to CPDF_Page
A new CPDF_PageContentGenerator is created for every call of
FPDFPage_GenerateContent, so having the maps there will cause duplicated
resources to be created every time this method is called. Thus it is better
to move these to the page.
Change-Id: I47804f79790fc5354f8a94b6387d66b65eda5a20
Reviewed-on: https://pdfium-review.googlesource.com/2717
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_page.h')
-rw-r--r-- | core/fpdfapi/page/cpdf_page.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h index 6d29a8f34e..9e303562c6 100644 --- a/core/fpdfapi/page/cpdf_page.h +++ b/core/fpdfapi/page/cpdf_page.h @@ -7,6 +7,7 @@ #ifndef CORE_FPDFAPI_PAGE_CPDF_PAGE_H_ #define CORE_FPDFAPI_PAGE_CPDF_PAGE_H_ +#include <map> #include <memory> #include "core/fpdfapi/page/cpdf_pageobjectholder.h" @@ -20,6 +21,19 @@ class CPDF_Object; class CPDF_PageRenderCache; class CPDF_PageRenderContext; +// These structs are used to keep track of resources that have already been +// generated in the page. +struct GraphicsData { + FX_FLOAT fillAlpha; + FX_FLOAT strokeAlpha; + bool operator<(const GraphicsData& other) const; +}; + +struct FontData { + CFX_ByteString baseFont; + bool operator<(const FontData& other) const; +}; + class CPDF_Page : public CPDF_PageObjectHolder { public: class View {}; // Caller implements as desired, empty here due to layering. @@ -52,6 +66,9 @@ class CPDF_Page : public CPDF_PageObjectHolder { View* GetView() const { return m_pView; } void SetView(View* pView) { m_pView = pView; } + std::map<GraphicsData, CFX_ByteString> m_GraphicsMap; + std::map<FontData, CFX_ByteString> m_FontsMap; + protected: void StartParse(); |