summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page')
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp10
-rw-r--r--core/fpdfapi/page/cpdf_page.h17
2 files changed, 27 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index ba30ce57c3..46123ab42e 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -175,3 +175,13 @@ CFX_Matrix CPDF_Page::GetDisplayMatrix(int xPos,
x0, y0));
return matrix;
}
+
+bool GraphicsData::operator<(const GraphicsData& other) const {
+ if (fillAlpha != other.fillAlpha)
+ return fillAlpha < other.fillAlpha;
+ return strokeAlpha < other.strokeAlpha;
+}
+
+bool FontData::operator<(const FontData& other) const {
+ return baseFont < other.baseFont;
+}
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();