summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_pageobjectholder.h
diff options
context:
space:
mode:
authorJane Liu <janeliulwq@google.com>2017-06-26 13:24:23 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-06-27 17:31:27 +0000
commit22eb7ae54e4351f70a5a01b0130c8b0dc713586c (patch)
tree7e2db8f7220b8c643cf3dd5c62281508155f8780 /core/fpdfapi/page/cpdf_pageobjectholder.h
parent62d5076d33ab2bbe0d70047ef98526cad427e631 (diff)
downloadpdfium-22eb7ae54e4351f70a5a01b0130c8b0dc713586c.tar.xz
Modified CPDF_PageContentGenerator to work with both Form and Page
CPDF_PageContentGenerator currently only works for CPDF_Page objects. However, CPDF_Form is also a CPDF_PageObjectHolder like CPDF_Page, and content streams can be generated for form objects too. This CL modifies the content generator to work with both forms and pages. The content generator will later be used on annotation objects' CPDF_Form to simplify the code for annotation AP stream generation. Change-Id: I1c50bdf0329d1f5788db23286ac72750355a10ed Reviewed-on: https://pdfium-review.googlesource.com/6837 Commit-Queue: Nicolás Peña <npm@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org>
Diffstat (limited to 'core/fpdfapi/page/cpdf_pageobjectholder.h')
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index c95ae50520..4733e06b2c 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -7,6 +7,7 @@
#ifndef CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECTHOLDER_H_
#define CORE_FPDFAPI_PAGE_CPDF_PAGEOBJECTHOLDER_H_
+#include <map>
#include <memory>
#include <vector>
@@ -25,11 +26,28 @@ class CPDF_ContentParser;
#define PDFTRANS_ISOLATED 0x0200
#define PDFTRANS_KNOCKOUT 0x0400
+// These structs are used to keep track of resources that have already been
+// generated in the page object holder.
+struct GraphicsData {
+ float fillAlpha;
+ float strokeAlpha;
+ int blendType;
+ bool operator<(const GraphicsData& other) const;
+};
+
+struct FontData {
+ CFX_ByteString baseFont;
+ CFX_ByteString type;
+ bool operator<(const FontData& other) const;
+};
+
class CPDF_PageObjectHolder {
public:
CPDF_PageObjectHolder(CPDF_Document* pDoc, CPDF_Dictionary* pFormDict);
virtual ~CPDF_PageObjectHolder();
+ virtual bool IsPage() const;
+
void ContinueParse(IFX_Pause* pPause);
bool IsParsed() const { return m_ParseState == CONTENT_PARSED; }
@@ -56,6 +74,8 @@ class CPDF_PageObjectHolder {
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> m_pPageResources;
CFX_UnownedPtr<CPDF_Dictionary> m_pResources;
+ std::map<GraphicsData, CFX_ByteString> m_GraphicsMap;
+ std::map<FontData, CFX_ByteString> m_FontsMap;
CFX_FloatRect m_BBox;
int m_Transparency;