Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_ | 7 #ifndef CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_ |
| 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_ | 8 #define CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_ |
| 9 | 9 |
| 10 #include <list> | |
| 10 #include <memory> | 11 #include <memory> |
| 11 | 12 |
| 12 #include "core/include/fpdfapi/fpdf_parser.h" | 13 #include "core/include/fpdfapi/fpdf_parser.h" |
| 13 #include "core/include/fpdfapi/fpdf_resource.h" | 14 #include "core/include/fpdfapi/fpdf_resource.h" |
| 14 #include "core/include/fxge/fx_dib.h" | 15 #include "core/include/fxge/fx_dib.h" |
| 15 | 16 |
| 16 class CPDF_Page; | 17 class CPDF_Page; |
| 17 class CPDF_Form; | 18 class CPDF_Form; |
| 18 class CPDF_ParseOptions; | 19 class CPDF_ParseOptions; |
| 19 class CPDF_PageObject; | 20 class CPDF_PageObject; |
| 20 class CPDF_PageRenderCache; | 21 class CPDF_PageRenderCache; |
| 21 class CPDF_StreamFilter; | 22 class CPDF_StreamFilter; |
| 22 class CPDF_AllStates; | 23 class CPDF_AllStates; |
| 23 class CPDF_ContentParser; | 24 class CPDF_ContentParser; |
| 24 class CPDF_StreamContentParser; | 25 class CPDF_StreamContentParser; |
| 25 | 26 |
| 26 #define PDFTRANS_GROUP 0x0100 | 27 #define PDFTRANS_GROUP 0x0100 |
| 27 #define PDFTRANS_ISOLATED 0x0200 | 28 #define PDFTRANS_ISOLATED 0x0200 |
| 28 #define PDFTRANS_KNOCKOUT 0x0400 | 29 #define PDFTRANS_KNOCKOUT 0x0400 |
| 29 | 30 |
| 30 class CPDF_PageObjectList : public CFX_PtrList { | 31 class CPDF_PageObjectList : public std::list<std::unique_ptr<CPDF_PageObject>> { |
| 31 public: | 32 public: |
| 32 explicit CPDF_PageObjectList(int nBlockSize) : CFX_PtrList(nBlockSize) {} | |
| 33 | |
| 34 CPDF_PageObject* GetNextObject(FX_POSITION& pos) const { | |
| 35 return static_cast<CPDF_PageObject*>(GetNext(pos)); | |
| 36 } | |
| 37 | |
| 38 CPDF_PageObject* GetPrevObject(FX_POSITION& pos) const { | |
| 39 return static_cast<CPDF_PageObject*>(GetPrev(pos)); | |
| 40 } | |
| 41 | |
| 42 CPDF_PageObject* GetObjectAt(FX_POSITION pos) const { | |
| 43 return static_cast<CPDF_PageObject*>(GetAt(pos)); | |
| 44 } | |
| 45 | |
| 46 // Linear complexity, to be avoided except as needed by public APIs. | 33 // Linear complexity, to be avoided except as needed by public APIs. |
| 47 CPDF_PageObject* GetObjectByIndex(int index) const; | 34 CPDF_PageObject* GetPageObjectByIndex(int index); |
| 48 | |
| 49 FX_POSITION InsertObject(FX_POSITION posInsertAfter, | |
| 50 CPDF_PageObject* pNewObject); | |
| 51 }; | 35 }; |
| 52 | 36 |
| 53 class CPDF_PageObjectHolder { | 37 class CPDF_PageObjectHolder { |
| 54 public: | 38 public: |
| 55 CPDF_PageObjectHolder(); | 39 CPDF_PageObjectHolder(); |
| 56 ~CPDF_PageObjectHolder(); | |
| 57 | 40 |
| 58 void ContinueParse(IFX_Pause* pPause); | 41 void ContinueParse(IFX_Pause* pPause); |
| 59 FX_BOOL IsParsed() const { return m_ParseState == CONTENT_PARSED; } | 42 FX_BOOL IsParsed() const { return m_ParseState == CONTENT_PARSED; } |
| 60 | 43 |
| 61 CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; } | 44 CPDF_PageObjectList* GetPageObjectList() { return &m_PageObjectList; } |
| 62 const CPDF_PageObjectList* GetPageObjectList() const { | 45 const CPDF_PageObjectList* GetPageObjectList() const { |
| 63 return &m_PageObjectList; | 46 return &m_PageObjectList; |
| 64 } | 47 } |
| 65 | 48 |
| 66 FX_BOOL BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; } | 49 FX_BOOL BackgroundAlphaNeeded() const { return m_bBackgroundAlphaNeeded; } |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 158 void ParseContent(CPDF_AllStates* pGraphicStates, | 141 void ParseContent(CPDF_AllStates* pGraphicStates, |
| 159 CFX_Matrix* pParentMatrix, | 142 CFX_Matrix* pParentMatrix, |
| 160 CPDF_Type3Char* pType3Char, | 143 CPDF_Type3Char* pType3Char, |
| 161 CPDF_ParseOptions* pOptions, | 144 CPDF_ParseOptions* pOptions, |
| 162 int level = 0); | 145 int level = 0); |
| 163 | 146 |
| 164 CPDF_Form* Clone() const; | 147 CPDF_Form* Clone() const; |
| 165 }; | 148 }; |
| 166 class CPDF_PageContentGenerator { | 149 class CPDF_PageContentGenerator { |
| 167 public: | 150 public: |
| 168 CPDF_PageContentGenerator(CPDF_Page* pPage); | 151 CPDF_PageContentGenerator(CPDF_Page* pPage); |
|
Lei Zhang
2016/02/18 00:38:44
explicit
Tom Sepez
2016/02/18 00:47:26
Done.
| |
| 169 ~CPDF_PageContentGenerator(); | 152 |
| 170 FX_BOOL InsertPageObject(CPDF_PageObject* pPageObject); | 153 FX_BOOL InsertPageObject(CPDF_PageObject* pPageObject); |
| 171 void GenerateContent(); | 154 void GenerateContent(); |
| 172 void TransformContent(CFX_Matrix& matrix); | 155 void TransformContent(CFX_Matrix& matrix); |
| 173 | 156 |
| 174 private: | 157 private: |
| 175 void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj); | 158 void ProcessImage(CFX_ByteTextBuf& buf, CPDF_ImageObject* pImageObj); |
| 176 void ProcessForm(CFX_ByteTextBuf& buf, | 159 void ProcessForm(CFX_ByteTextBuf& buf, |
| 177 const uint8_t* data, | 160 const uint8_t* data, |
| 178 FX_DWORD size, | 161 FX_DWORD size, |
| 179 CFX_Matrix& matrix); | 162 CFX_Matrix& matrix); |
| 180 CFX_ByteString RealizeResource(CPDF_Object* pResourceObj, | 163 CFX_ByteString RealizeResource(CPDF_Object* pResourceObj, |
| 181 const FX_CHAR* szType); | 164 const FX_CHAR* szType); |
| 182 | 165 |
| 183 CPDF_Page* m_pPage; | 166 CPDF_Page* m_pPage; |
| 184 CPDF_Document* m_pDocument; | 167 CPDF_Document* m_pDocument; |
| 185 CFX_ArrayTemplate<CPDF_PageObject*> m_pageObjects; | 168 CFX_ArrayTemplate<CPDF_PageObject*> m_pageObjects; |
| 186 }; | 169 }; |
| 187 | 170 |
| 188 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_ | 171 #endif // CORE_INCLUDE_FPDFAPI_FPDF_PAGE_H_ |
| OLD | NEW |