summaryrefslogtreecommitdiff
path: root/core/include
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-16 17:15:32 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-16 17:15:32 -0800
commit32c70815316672091946be88e5941089c359d151 (patch)
tree5c09a48725bb43b07d09a435f38ead6a933e1712 /core/include
parent4e44b4049bd4790bcb6c835455632c81c34e78b6 (diff)
downloadpdfium-32c70815316672091946be88e5941089c359d151.tar.xz
Split CPDF_PageObjectHolder off from CPDF_PageObjectList
Eventually, we're going to expose an iterator over CPDF_PageObjectList that we don't want to be inherited by the CPDF_PageObjectHolder sub-classes: page and form. Also, the operations that the object holder performs dealing with inquiring about masks and such seem beyond the scope of what a list would provide. Hence the "Holder" name. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1701073002 .
Diffstat (limited to 'core/include')
-rw-r--r--core/include/fpdfapi/fpdf_module.h1
-rw-r--r--core/include/fpdfapi/fpdf_page.h52
-rw-r--r--core/include/fpdfapi/fpdf_render.h4
-rw-r--r--core/include/fpdftext/fpdf_text.h3
4 files changed, 28 insertions, 32 deletions
diff --git a/core/include/fpdfapi/fpdf_module.h b/core/include/fpdfapi/fpdf_module.h
index 6888e81000..4856184932 100644
--- a/core/include/fpdfapi/fpdf_module.h
+++ b/core/include/fpdfapi/fpdf_module.h
@@ -24,7 +24,6 @@ class CPDF_Document;
class CPDF_FontGlobals;
class CPDF_Image;
class CPDF_Page;
-class CPDF_PageObjectList;
class CPDF_PageRenderCache;
class CPDF_RenderOptions;
class CPDF_Stream;
diff --git a/core/include/fpdfapi/fpdf_page.h b/core/include/fpdfapi/fpdf_page.h
index 20030e7dea..fb951280a2 100644
--- a/core/include/fpdfapi/fpdf_page.h
+++ b/core/include/fpdfapi/fpdf_page.h
@@ -22,50 +22,46 @@ class CPDF_StreamFilter;
class CPDF_AllStates;
class CPDF_ContentParser;
class CPDF_StreamContentParser;
+
#define PDFTRANS_GROUP 0x0100
#define PDFTRANS_ISOLATED 0x0200
#define PDFTRANS_KNOCKOUT 0x0400
-class CPDF_PageObjectList {
+class CPDF_PageObjectList : public CFX_PtrList {
public:
- CPDF_PageObjectList();
- ~CPDF_PageObjectList();
-
- void ContinueParse(IFX_Pause* pPause);
-
- FX_BOOL IsParsed() const { return m_ParseState == CONTENT_PARSED; }
-
- FX_POSITION GetFirstObjectPosition() const {
- return m_ObjectList.GetHeadPosition();
- }
-
- FX_POSITION GetLastObjectPosition() const {
- return m_ObjectList.GetTailPosition();
- }
+ explicit CPDF_PageObjectList(int nBlockSize) : CFX_PtrList(nBlockSize) {}
CPDF_PageObject* GetNextObject(FX_POSITION& pos) const {
- return (CPDF_PageObject*)m_ObjectList.GetNext(pos);
+ return static_cast<CPDF_PageObject*>(GetNext(pos));
}
CPDF_PageObject* GetPrevObject(FX_POSITION& pos) const {
- return (CPDF_PageObject*)m_ObjectList.GetPrev(pos);
+ return static_cast<CPDF_PageObject*>(GetPrev(pos));
}
CPDF_PageObject* GetObjectAt(FX_POSITION pos) const {
- return (CPDF_PageObject*)m_ObjectList.GetAt(pos);
+ return static_cast<CPDF_PageObject*>(GetAt(pos));
}
- void AddTail(CPDF_PageObject* obj) { m_ObjectList.AddTail(obj); }
- FX_DWORD CountObjects() const { return m_ObjectList.GetCount(); }
-
- int GetObjectIndex(CPDF_PageObject* pObj) const;
-
+ // Linear complexity, to be avoided except as needed by public APIs.
CPDF_PageObject* GetObjectByIndex(int index) const;
FX_POSITION InsertObject(FX_POSITION posInsertAfter,
CPDF_PageObject* pNewObject);
+};
- void Transform(const CFX_Matrix& matrix);
+class CPDF_PageObjectHolder {
+ public:
+ CPDF_PageObjectHolder();
+ ~CPDF_PageObjectHolder();
+
+ void ContinueParse(IFX_Pause* pPause);
+ FX_BOOL IsParsed() const { return m_ParseState == CONTENT_PARSED; }
+
+ CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; }
+ const CPDF_PageObjectList* GetPageObjectList() const {
+ return &m_PageObjectList;
+ }
FX_BOOL BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; }
void SetBackgroundAlphaNeeded(FX_BOOL needed) {
@@ -74,6 +70,8 @@ class CPDF_PageObjectList {
FX_BOOL HasImageMask() const { return m_bHasImageMask; }
void SetHasImageMask(FX_BOOL value) { m_bHasImageMask = value; }
+
+ void Transform(const CFX_Matrix& matrix);
CFX_FloatRect CalcBoundingBox() const;
CPDF_Dictionary* m_pFormDict;
@@ -93,10 +91,10 @@ class CPDF_PageObjectList {
FX_BOOL m_bHasImageMask;
ParseState m_ParseState;
std::unique_ptr<CPDF_ContentParser> m_pParser;
- CFX_PtrList m_ObjectList;
+ CPDF_PageObjectList m_PageObjectList;
};
-class CPDF_Page : public CPDF_PageObjectList, public CFX_PrivateData {
+class CPDF_Page : public CPDF_PageObjectHolder, public CFX_PrivateData {
public:
CPDF_Page();
~CPDF_Page();
@@ -142,7 +140,7 @@ class CPDF_ParseOptions {
FX_BOOL m_bDecodeInlineImage;
};
-class CPDF_Form : public CPDF_PageObjectList {
+class CPDF_Form : public CPDF_PageObjectHolder {
public:
CPDF_Form(CPDF_Document* pDocument,
CPDF_Dictionary* pPageResources,
diff --git a/core/include/fpdfapi/fpdf_render.h b/core/include/fpdfapi/fpdf_render.h
index ec5d151914..fc0f68afe8 100644
--- a/core/include/fpdfapi/fpdf_render.h
+++ b/core/include/fpdfapi/fpdf_render.h
@@ -74,7 +74,7 @@ class CPDF_RenderContext {
public:
class Layer {
public:
- CPDF_PageObjectList* m_pObjectList;
+ CPDF_PageObjectHolder* m_pObjectHolder;
CFX_Matrix m_Matrix;
};
@@ -82,7 +82,7 @@ class CPDF_RenderContext {
CPDF_RenderContext(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache);
~CPDF_RenderContext();
- void AppendLayer(CPDF_PageObjectList* pObjectList,
+ void AppendLayer(CPDF_PageObjectHolder* pObjectHolder,
const CFX_Matrix* pObject2Device);
void Render(CFX_RenderDevice* pDevice,
diff --git a/core/include/fpdftext/fpdf_text.h b/core/include/fpdftext/fpdf_text.h
index 140fe90bf7..498b6235c3 100644
--- a/core/include/fpdftext/fpdf_text.h
+++ b/core/include/fpdftext/fpdf_text.h
@@ -10,7 +10,6 @@
#include "core/include/fpdfapi/fpdf_parser.h"
class CPDF_Page;
-class CPDF_PageObjectList;
class CPDF_TextObject;
class IPDF_LinkExtract;
class IPDF_ReflowedPage;
@@ -50,7 +49,7 @@ class IPDF_TextPage {
static IPDF_TextPage* CreateReflowTextPage(IPDF_ReflowedPage* pRefPage);
virtual ~IPDF_TextPage() {}
- virtual FX_BOOL ParseTextPage() = 0;
+ virtual void ParseTextPage() = 0;
virtual bool IsParsed() const = 0;
virtual int CharIndexFromTextIndex(int TextIndex) const = 0;
virtual int TextIndexFromCharIndex(int CharIndex) const = 0;