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 "../../../include/fpdfapi/fpdf_pageobj.h" | 10 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
11 | 11 |
12 #define PARSE_STEP_LIMIT 100 | 12 #define PARSE_STEP_LIMIT 100 |
13 #define STREAM_PARSE_BUFSIZE 20480 | 13 #define STREAM_PARSE_BUFSIZE 20480 |
14 class CPDF_QuickFontCache; | 14 class CPDF_QuickFontCache; |
15 class CPDF_StreamParser | 15 class CPDF_StreamParser |
16 { | 16 { |
17 public: | 17 public: |
18 | 18 |
19 CPDF_StreamParser(const FX_BYTE* pData, FX_DWORD dwSize); | 19 CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); |
20 ~CPDF_StreamParser(); | 20 ~CPDF_StreamParser(); |
21 | 21 |
22 CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti
onary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode); | 22 CPDF_Stream* ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti
onary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode); |
23 typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; | 23 typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; |
24 | 24 |
25 SyntaxType ParseNextElement(); | 25 SyntaxType ParseNextElement(); |
26 FX_LPBYTE GetWordBuf() | 26 FX_LPBYTE GetWordBuf() |
27 { | 27 { |
28 return m_WordBuffer; | 28 return m_WordBuffer; |
29 } | 29 } |
(...skipping 15 matching lines...) Expand all Loading... |
45 { | 45 { |
46 m_Pos = pos; | 46 m_Pos = pos; |
47 } | 47 } |
48 | 48 |
49 CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE
, FX_BOOL bInArray = FALSE); | 49 CPDF_Object* ReadNextObject(FX_BOOL bAllowNestedArray = FALSE
, FX_BOOL bInArray = FALSE); |
50 void SkipPathObject(); | 50 void SkipPathObject(); |
51 protected: | 51 protected: |
52 void GetNextWord(FX_BOOL& bIsNumber); | 52 void GetNextWord(FX_BOOL& bIsNumber); |
53 CFX_ByteString ReadString(); | 53 CFX_ByteString ReadString(); |
54 CFX_ByteString ReadHexString(); | 54 CFX_ByteString ReadHexString(); |
55 const FX_BYTE*» » m_pBuf; | 55 const uint8_t*» » m_pBuf; |
56 FX_DWORD m_Size; | 56 FX_DWORD m_Size; |
57 FX_DWORD m_Pos; | 57 FX_DWORD m_Pos; |
58 FX_BYTE» » » » m_WordBuffer[256]; | 58 uint8_t» » » » m_WordBuffer[256]; |
59 FX_DWORD m_WordSize; | 59 FX_DWORD m_WordSize; |
60 CPDF_Object* m_pLastObj; | 60 CPDF_Object* m_pLastObj; |
61 }; | 61 }; |
62 typedef enum { | 62 typedef enum { |
63 PDFOP_CloseFillStrokePath = 0, PDFOP_FillStrokePath, | 63 PDFOP_CloseFillStrokePath = 0, PDFOP_FillStrokePath, |
64 PDFOP_CloseEOFillStrokePath, PDFOP_EOFillStrokePath, | 64 PDFOP_CloseEOFillStrokePath, PDFOP_EOFillStrokePath, |
65 PDFOP_BeginMarkedContent_Dictionary, PDFOP_BeginImage, | 65 PDFOP_BeginMarkedContent_Dictionary, PDFOP_BeginImage, |
66 PDFOP_BeginMarkedContent, PDFOP_BeginText, | 66 PDFOP_BeginMarkedContent, PDFOP_BeginText, |
67 PDFOP_BeginSectionUndefined, PDFOP_CurveTo_123, | 67 PDFOP_BeginSectionUndefined, PDFOP_CurveTo_123, |
68 PDFOP_ConcatMatrix, PDFOP_SetColorSpace_Fill, | 68 PDFOP_ConcatMatrix, PDFOP_SetColorSpace_Fill, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 void AddObjectParam(CPDF_Object* pObj); | 146 void AddObjectParam(CPDF_Object* pObj); |
147 void AddNameParam(FX_LPCSTR name, int size); | 147 void AddNameParam(FX_LPCSTR name, int size); |
148 int GetNextParamPos(); | 148 int GetNextParamPos(); |
149 void ClearAllParams(); | 149 void ClearAllParams(); |
150 CPDF_Object* GetObject(FX_DWORD index); | 150 CPDF_Object* GetObject(FX_DWORD index); |
151 CFX_ByteString GetString(FX_DWORD index); | 151 CFX_ByteString GetString(FX_DWORD index); |
152 FX_FLOAT GetNumber(FX_DWORD index); | 152 FX_FLOAT GetNumber(FX_DWORD index); |
153 FX_FLOAT GetNumber16(FX_DWORD index); | 153 FX_FLOAT GetNumber16(FX_DWORD index); |
154 int GetInteger(FX_DWORD index) | 154 int GetInteger(FX_DWORD index) |
155 { | 155 { |
156 return (FX_INT32)(GetNumber(index)); | 156 return (int32_t)(GetNumber(index)); |
157 } | 157 } |
158 FX_BOOL OnOperator(FX_LPCSTR op); | 158 FX_BOOL OnOperator(FX_LPCSTR op); |
159 void BigCaseCaller(int index); | 159 void BigCaseCaller(int index); |
160 FX_BOOL m_bAbort; | 160 FX_BOOL m_bAbort; |
161 CPDF_StreamParser* m_pSyntax; | 161 CPDF_StreamParser* m_pSyntax; |
162 FX_DWORD GetParsePos() | 162 FX_DWORD GetParsePos() |
163 { | 163 { |
164 return m_pSyntax->GetPos(); | 164 return m_pSyntax->GetPos(); |
165 } | 165 } |
166 CPDF_AllStates* m_pCurStates; | 166 CPDF_AllStates* m_pCurStates; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 { | 331 { |
332 FX_POSITION pos = map.GetStartPosition(); | 332 FX_POSITION pos = map.GetStartPosition(); |
333 while (pos) { | 333 while (pos) { |
334 KeyType findKey; | 334 KeyType findKey; |
335 map.GetNextAssoc(pos, findKey, findData); | 335 map.GetNextAssoc(pos, findKey, findData); |
336 if (findData->m_Obj == findValue) { | 336 if (findData->m_Obj == findValue) { |
337 return findKey; | 337 return findKey; |
338 } | 338 } |
339 } | 339 } |
340 findData = NULL; | 340 findData = NULL; |
341 return (KeyType)(FX_UINTPTR)NULL; | 341 return (KeyType)(uintptr_t)NULL; |
342 } | 342 } |
343 template <class KeyType, class ValueType> | 343 template <class KeyType, class ValueType> |
344 FX_BOOL PDF_DocPageData_Release(CFX_MapPtrTemplate<KeyType, CPDF_CountedObject<V
alueType>*> &map, KeyType findKey, ValueType findValue, FX_BOOL bForce = FALSE) | 344 FX_BOOL PDF_DocPageData_Release(CFX_MapPtrTemplate<KeyType, CPDF_CountedObject<V
alueType>*> &map, KeyType findKey, ValueType findValue, FX_BOOL bForce = FALSE) |
345 { | 345 { |
346 if (!findKey && !findValue) { | 346 if (!findKey && !findValue) { |
347 return FALSE; | 347 return FALSE; |
348 } | 348 } |
349 CPDF_CountedObject<ValueType>* findData = NULL; | 349 CPDF_CountedObject<ValueType>* findData = NULL; |
350 if (!findKey) { | 350 if (!findKey) { |
351 findKey = PDF_DocPageData_FindValue<KeyType, ValueType>(map, findValue,
findData); | 351 findKey = PDF_DocPageData_FindValue<KeyType, ValueType>(map, findValue,
findData); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 FX_FLOAT* m_pRanges; | 415 FX_FLOAT* m_pRanges; |
416 FX_BOOL Init(CPDF_Object* pObj); | 416 FX_BOOL Init(CPDF_Object* pObj); |
417 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; | 417 virtual FX_BOOL v_Init(CPDF_Object* pObj) = 0; |
418 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; | 418 virtual FX_BOOL v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; |
419 }; | 419 }; |
420 class CPDF_IccProfile | 420 class CPDF_IccProfile |
421 { | 421 { |
422 public: | 422 public: |
423 CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize); | 423 CPDF_IccProfile(FX_LPCBYTE pData, FX_DWORD dwSize); |
424 ~CPDF_IccProfile(); | 424 ~CPDF_IccProfile(); |
425 FX_INT32 GetComponents() const { return m_nSrcComponents; } | 425 int32_t GetComponents() const { return m_nSrcComponents; } |
426 FX_BOOL m_bsRGB; | 426 FX_BOOL m_bsRGB; |
427 FX_LPVOID m_pTransform; | 427 FX_LPVOID m_pTransform; |
428 private: | 428 private: |
429 FX_INT32 m_nSrcComponents; | 429 int32_t m_nSrcComponents; |
430 }; | 430 }; |
431 class CPDF_DeviceCS : public CPDF_ColorSpace | 431 class CPDF_DeviceCS : public CPDF_ColorSpace |
432 { | 432 { |
433 public: | 433 public: |
434 CPDF_DeviceCS(int family); | 434 CPDF_DeviceCS(int family); |
435 virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA
T& B) const; | 435 virtual FX_BOOL GetRGB(FX_FLOAT* pBuf, FX_FLOAT& R, FX_FLOAT& G, FX_FLOA
T& B) const; |
436 FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
; | 436 FX_BOOL SetRGB(FX_FLOAT* pBuf, FX_FLOAT R, FX_FLOAT G, FX_FLOAT B) const
; |
437 FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y,
FX_FLOAT& k) const; | 437 FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, FX_FLOAT& c, FX_FLOAT& m, FX_FLOAT& y,
FX_FLOAT& k) const; |
438 FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX
_FLOAT k) const; | 438 FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, FX_FLOAT c, FX_FLOAT m, FX_FLOAT y, FX
_FLOAT k) const; |
439 virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBu
f, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) co
nst; | 439 virtual void TranslateImageLine(FX_LPBYTE pDestBuf, FX_LPCBYTE pSrcBu
f, int pixels, int image_width, int image_height, FX_BOOL bTransMask = FALSE) co
nst; |
(...skipping 20 matching lines...) Expand all Loading... |
460 CFX_ByteString m_Prefix; | 460 CFX_ByteString m_Prefix; |
461 int m_nIndex; | 461 int m_nIndex; |
462 }; | 462 }; |
463 ~CPDF_ResourceNaming(); | 463 ~CPDF_ResourceNaming(); |
464 CFX_ByteString GetName(const CPDF_Dictionary* pResList, FX_LPCS
TR szType); | 464 CFX_ByteString GetName(const CPDF_Dictionary* pResList, FX_LPCS
TR szType); |
465 protected: | 465 protected: |
466 CFX_MapByteStringToPtr m_NamingCache; | 466 CFX_MapByteStringToPtr m_NamingCache; |
467 }; | 467 }; |
468 | 468 |
469 #endif // CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 469 #endif // CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
OLD | NEW |