| 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_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 7 #ifndef CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| 8 #define CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 8 #define CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 | 11 |
| 12 #include "../../../../third_party/base/nonstd_unique_ptr.h" | 12 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
| 13 #include "../../../include/fpdfapi/fpdf_page.h" |
| 13 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 14 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
| 14 | 15 |
| 16 class CPDF_AllStates; |
| 17 class CPDF_ParseOptions; |
| 18 |
| 15 #define PARSE_STEP_LIMIT 100 | 19 #define PARSE_STEP_LIMIT 100 |
| 16 | 20 |
| 17 class CPDF_StreamParser { | 21 class CPDF_StreamParser { |
| 18 public: | 22 public: |
| 19 CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); | 23 CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); |
| 20 ~CPDF_StreamParser(); | 24 ~CPDF_StreamParser(); |
| 21 | 25 |
| 22 CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, | 26 CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, |
| 23 CPDF_Dictionary* pDict, | 27 CPDF_Dictionary* pDict, |
| 24 CPDF_Object* pCSObj, | 28 CPDF_Object* pCSObj, |
| 25 FX_BOOL bDecode); | 29 FX_BOOL bDecode); |
| 26 typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; | 30 typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; |
| 27 | 31 |
| 28 SyntaxType ParseNextElement(); | 32 SyntaxType ParseNextElement(); |
| 29 uint8_t* GetWordBuf() { return m_WordBuffer; } | 33 uint8_t* GetWordBuf() { return m_WordBuffer; } |
| 30 FX_DWORD GetWordSize() { return m_WordSize; } | 34 FX_DWORD GetWordSize() { return m_WordSize; } |
| 31 CPDF_Object* GetObject() { | 35 CPDF_Object* GetObject() { |
| 32 CPDF_Object* pObj = m_pLastObj; | 36 CPDF_Object* pObj = m_pLastObj; |
| 33 m_pLastObj = NULL; | 37 m_pLastObj = NULL; |
| 34 return pObj; | 38 return pObj; |
| 35 } | 39 } |
| 36 FX_DWORD GetPos() { return m_Pos; } | 40 FX_DWORD GetPos() { return m_Pos; } |
| 37 void SetPos(FX_DWORD pos) { m_Pos = pos; } | 41 void SetPos(FX_DWORD pos) { m_Pos = pos; } |
| 38 | 42 |
| 39 CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE, | 43 CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE, |
| 40 FX_BOOL bInArray = FALSE); | 44 FX_BOOL bInArray = FALSE); |
| 41 void SkipPathObject(); | 45 void SkipPathObject(); |
| 42 | 46 |
| 43 protected: | 47 protected: |
| 48 friend class fpdf_page_parser_old_ReadHexString_Test; |
| 49 |
| 44 void GetNextWord(FX_BOOL& bIsNumber); | 50 void GetNextWord(FX_BOOL& bIsNumber); |
| 45 CFX_ByteString ReadString(); | 51 CFX_ByteString ReadString(); |
| 46 CFX_ByteString ReadHexString(); | 52 CFX_ByteString ReadHexString(); |
| 47 const uint8_t* m_pBuf; | 53 const uint8_t* m_pBuf; |
| 48 | 54 |
| 49 // Length in bytes of m_pBuf. | 55 // Length in bytes of m_pBuf. |
| 50 FX_DWORD m_Size; | 56 FX_DWORD m_Size; |
| 51 | 57 |
| 52 // Current byte position within m_pBuf. | 58 // Current byte position within m_pBuf. |
| 53 FX_DWORD m_Pos; | 59 FX_DWORD m_Pos; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 FX_FLOAT& G, | 519 FX_FLOAT& G, |
| 514 FX_FLOAT& B) const override; | 520 FX_FLOAT& B) const override; |
| 515 CPDF_ColorSpace* GetBaseCS() const override; | 521 CPDF_ColorSpace* GetBaseCS() const override; |
| 516 | 522 |
| 517 private: | 523 private: |
| 518 CPDF_ColorSpace* m_pBaseCS; | 524 CPDF_ColorSpace* m_pBaseCS; |
| 519 CPDF_CountedColorSpace* m_pCountedBaseCS; | 525 CPDF_CountedColorSpace* m_pCountedBaseCS; |
| 520 }; | 526 }; |
| 521 | 527 |
| 522 #endif // CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 528 #endif // CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| OLD | NEW |