summaryrefslogtreecommitdiff
path: root/core/include/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/include/fpdfapi')
-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
3 files changed, 27 insertions, 30 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,