| 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_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 7 #ifndef CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| 8 #define CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 8 #define CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <set> | 12 #include <set> |
| 13 #include <unordered_map> | 13 #include <unordered_map> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "core/fpdfapi/fpdf_page/cpdf_contentmark.h" | 16 #include "core/fpdfapi/fpdf_page/cpdf_contentmark.h" |
| 17 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" | 17 #include "core/fpdfapi/fpdf_page/cpdf_countedobject.h" |
| 18 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" | 18 #include "core/fpdfapi/fpdf_page/include/cpdf_pageobjectholder.h" |
| 19 #include "core/fxcrt/include/cfx_string_pool_template.h" |
| 20 #include "core/fxcrt/include/cfx_weak_ptr.h" |
| 19 #include "core/fxge/include/cfx_pathdata.h" | 21 #include "core/fxge/include/cfx_pathdata.h" |
| 20 #include "core/fxge/include/cfx_renderdevice.h" | 22 #include "core/fxge/include/cfx_renderdevice.h" |
| 21 | 23 |
| 22 class CPDF_AllStates; | 24 class CPDF_AllStates; |
| 23 class CPDF_ColorSpace; | 25 class CPDF_ColorSpace; |
| 24 class CPDF_ExpIntFunc; | 26 class CPDF_ExpIntFunc; |
| 25 class CPDF_Font; | 27 class CPDF_Font; |
| 26 class CPDF_FontEncoding; | 28 class CPDF_FontEncoding; |
| 27 class CPDF_Form; | 29 class CPDF_Form; |
| 28 class CPDF_IccProfile; | 30 class CPDF_IccProfile; |
| 29 class CPDF_Image; | 31 class CPDF_Image; |
| 30 class CPDF_ImageObject; | 32 class CPDF_ImageObject; |
| 31 class CPDF_Page; | 33 class CPDF_Page; |
| 32 class CPDF_Pattern; | 34 class CPDF_Pattern; |
| 33 class CPDF_SampledFunc; | 35 class CPDF_SampledFunc; |
| 34 class CPDF_StitchFunc; | 36 class CPDF_StitchFunc; |
| 35 class CPDF_StreamAcc; | 37 class CPDF_StreamAcc; |
| 36 class CPDF_TextObject; | 38 class CPDF_TextObject; |
| 37 class CPDF_Type3Char; | 39 class CPDF_Type3Char; |
| 38 | 40 |
| 39 #define PARSE_STEP_LIMIT 100 | 41 #define PARSE_STEP_LIMIT 100 |
| 40 | 42 |
| 41 class CPDF_StreamParser { | 43 class CPDF_StreamParser { |
| 42 public: | 44 public: |
| 43 enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; | 45 enum SyntaxType { EndOfData, Number, Keyword, Name, Others }; |
| 44 | 46 |
| 45 CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize); | 47 CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize); |
| 48 CPDF_StreamParser(const uint8_t* pData, |
| 49 uint32_t dwSize, |
| 50 const CFX_WeakPtr<CFX_ByteStringPool>& pPool); |
| 46 ~CPDF_StreamParser(); | 51 ~CPDF_StreamParser(); |
| 47 | 52 |
| 48 CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, | 53 CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, |
| 49 CPDF_Dictionary* pDict, | 54 CPDF_Dictionary* pDict, |
| 50 CPDF_Object* pCSObj); | 55 CPDF_Object* pCSObj); |
| 51 SyntaxType ParseNextElement(); | 56 SyntaxType ParseNextElement(); |
| 52 uint8_t* GetWordBuf() { return m_WordBuffer; } | 57 uint8_t* GetWordBuf() { return m_WordBuffer; } |
| 53 uint32_t GetWordSize() const { return m_WordSize; } | 58 uint32_t GetWordSize() const { return m_WordSize; } |
| 54 CPDF_Object* GetObject() { | 59 CPDF_Object* GetObject() { |
| 55 CPDF_Object* pObj = m_pLastObj; | 60 CPDF_Object* pObj = m_pLastObj; |
| 56 m_pLastObj = nullptr; | 61 m_pLastObj = nullptr; |
| 57 return pObj; | 62 return pObj; |
| 58 } | 63 } |
| 59 uint32_t GetPos() const { return m_Pos; } | 64 uint32_t GetPos() const { return m_Pos; } |
| 60 void SetPos(uint32_t pos) { m_Pos = pos; } | 65 void SetPos(uint32_t pos) { m_Pos = pos; } |
| 61 CPDF_Object* ReadNextObject(bool bAllowNestedArray, uint32_t dwInArrayLevel); | 66 CPDF_Object* ReadNextObject(bool bAllowNestedArray, uint32_t dwInArrayLevel); |
| 62 | 67 |
| 63 protected: | 68 protected: |
| 64 friend class fpdf_page_parser_old_ReadHexString_Test; | 69 friend class fpdf_page_parser_old_ReadHexString_Test; |
| 65 | 70 |
| 66 void GetNextWord(FX_BOOL& bIsNumber); | 71 void GetNextWord(FX_BOOL& bIsNumber); |
| 67 CFX_ByteString ReadString(); | 72 CFX_ByteString ReadString(); |
| 68 CFX_ByteString ReadHexString(); | 73 CFX_ByteString ReadHexString(); |
| 74 |
| 69 const uint8_t* m_pBuf; | 75 const uint8_t* m_pBuf; |
| 70 | 76 uint32_t m_Size; // Length in bytes of m_pBuf. |
| 71 // Length in bytes of m_pBuf. | 77 uint32_t m_Pos; // Current byte position within m_pBuf. |
| 72 uint32_t m_Size; | |
| 73 | |
| 74 // Current byte position within m_pBuf. | |
| 75 uint32_t m_Pos; | |
| 76 | |
| 77 uint8_t m_WordBuffer[256]; | 78 uint8_t m_WordBuffer[256]; |
| 78 uint32_t m_WordSize; | 79 uint32_t m_WordSize; |
| 79 CPDF_Object* m_pLastObj; | 80 CPDF_Object* m_pLastObj; |
| 81 CFX_WeakPtr<CFX_ByteStringPool> m_pPool; |
| 80 | 82 |
| 81 private: | 83 private: |
| 82 bool PositionIsInBounds() const; | 84 bool PositionIsInBounds() const; |
| 83 }; | 85 }; |
| 84 | 86 |
| 85 #define PARAM_BUF_SIZE 16 | 87 #define PARAM_BUF_SIZE 16 |
| 86 struct ContentParam { | 88 struct ContentParam { |
| 87 enum Type { OBJECT = 0, NUMBER, NAME }; | 89 enum Type { OBJECT = 0, NUMBER, NAME }; |
| 88 Type m_Type; | 90 Type m_Type; |
| 89 union { | 91 union { |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 555 }; | 557 }; |
| 556 | 558 |
| 557 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); | 559 CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr); |
| 558 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( | 560 CFX_ByteStringC PDF_FindValueAbbreviationForTesting( |
| 559 const CFX_ByteStringC& abbr); | 561 const CFX_ByteStringC& abbr); |
| 560 | 562 |
| 561 void PDF_ReplaceAbbr(CPDF_Object* pObj); | 563 void PDF_ReplaceAbbr(CPDF_Object* pObj); |
| 562 bool IsPathOperator(const uint8_t* buf, size_t len); | 564 bool IsPathOperator(const uint8_t* buf, size_t len); |
| 563 | 565 |
| 564 #endif // CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 566 #endif // CORE_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
| OLD | NEW |