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_pageobj.h" | 13 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
14 | 14 |
15 #define PARSE_STEP_LIMIT 100 | 15 #define PARSE_STEP_LIMIT 100 |
16 | 16 |
17 class CPDF_StreamParser | 17 class CPDF_StreamParser |
18 { | 18 { |
19 public: | 19 public: |
20 | 20 |
21 CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); | 21 CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize); |
22 ~CPDF_StreamParser(); | 22 ~CPDF_StreamParser(); |
23 | 23 |
24 CPDF_Stream*» » ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti
onary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode); | 24 CPDF_Stream*» » ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti
onary* pDict, CPDF_Object* pCSObj, bool bDecode); |
25 typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; | 25 typedef enum { EndOfData, Number, Keyword, Name, Others } SyntaxType; |
26 | 26 |
27 SyntaxType ParseNextElement(); | 27 SyntaxType ParseNextElement(); |
28 uint8_t* GetWordBuf() | 28 uint8_t* GetWordBuf() |
29 { | 29 { |
30 return m_WordBuffer; | 30 return m_WordBuffer; |
31 } | 31 } |
32 FX_DWORD GetWordSize() | 32 FX_DWORD GetWordSize() |
33 { | 33 { |
34 return m_WordSize; | 34 return m_WordSize; |
35 } | 35 } |
36 CPDF_Object* GetObject() | 36 CPDF_Object* GetObject() |
37 { | 37 { |
38 CPDF_Object* pObj = m_pLastObj; | 38 CPDF_Object* pObj = m_pLastObj; |
39 m_pLastObj = NULL; | 39 m_pLastObj = NULL; |
40 return pObj; | 40 return pObj; |
41 } | 41 } |
42 FX_DWORD GetPos() | 42 FX_DWORD GetPos() |
43 { | 43 { |
44 return m_Pos; | 44 return m_Pos; |
45 } | 45 } |
46 void SetPos(FX_DWORD pos) | 46 void SetPos(FX_DWORD pos) |
47 { | 47 { |
48 m_Pos = pos; | 48 m_Pos = pos; |
49 } | 49 } |
50 | 50 |
51 CPDF_Object*» » ReadNextObject(FX_BOOL bAllowNestedArray = FALSE
, FX_BOOL bInArray = FALSE); | 51 CPDF_Object*» » ReadNextObject(bool bAllowNestedArray = false, b
ool bInArray = false); |
52 void SkipPathObject(); | 52 void SkipPathObject(); |
53 protected: | 53 protected: |
54 void» » » » GetNextWord(FX_BOOL& bIsNumber); | 54 void» » » » GetNextWord(bool& bIsNumber); |
55 CFX_ByteString ReadString(); | 55 CFX_ByteString ReadString(); |
56 CFX_ByteString ReadHexString(); | 56 CFX_ByteString ReadHexString(); |
57 const uint8_t* m_pBuf; | 57 const uint8_t* m_pBuf; |
58 FX_DWORD m_Size; | 58 FX_DWORD m_Size; |
59 FX_DWORD m_Pos; | 59 FX_DWORD m_Pos; |
60 uint8_t m_WordBuffer[256]; | 60 uint8_t m_WordBuffer[256]; |
61 FX_DWORD m_WordSize; | 61 FX_DWORD m_WordSize; |
62 CPDF_Object* m_pLastObj; | 62 CPDF_Object* m_pLastObj; |
63 }; | 63 }; |
64 typedef enum { | 64 typedef enum { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 PDFOP_CurveTo_23, PDFOP_SetLineWidth, | 98 PDFOP_CurveTo_23, PDFOP_SetLineWidth, |
99 PDFOP_Clip, PDFOP_EOClip, | 99 PDFOP_Clip, PDFOP_EOClip, |
100 PDFOP_CurveTo_13, PDFOP_NextLineShowText, | 100 PDFOP_CurveTo_13, PDFOP_NextLineShowText, |
101 PDFOP_NextLineShowText_Space, PDFOP_Invalid | 101 PDFOP_NextLineShowText_Space, PDFOP_Invalid |
102 } PDFOP; | 102 } PDFOP; |
103 #define PARAM_BUF_SIZE 16 | 103 #define PARAM_BUF_SIZE 16 |
104 typedef struct { | 104 typedef struct { |
105 int m_Type; | 105 int m_Type; |
106 union { | 106 union { |
107 struct { | 107 struct { |
108 FX_BOOL» » m_bInteger; | 108 bool» » m_bInteger; |
109 union { | 109 union { |
110 int m_Integer; | 110 int m_Integer; |
111 FX_FLOAT m_Float; | 111 FX_FLOAT m_Float; |
112 }; | 112 }; |
113 } m_Number; | 113 } m_Number; |
114 CPDF_Object* m_pObject; | 114 CPDF_Object* m_pObject; |
115 struct { | 115 struct { |
116 int m_Len; | 116 int m_Len; |
117 char m_Buffer[32]; | 117 char m_Buffer[32]; |
118 } m_Name; | 118 } m_Name; |
(...skipping 11 matching lines...) Expand all Loading... |
130 CPDF_Dictionary* pParentResources, | 130 CPDF_Dictionary* pParentResources, |
131 CFX_AffineMatrix* pmtContentToUser, | 131 CFX_AffineMatrix* pmtContentToUser, |
132 CPDF_PageObjects* pObjList, | 132 CPDF_PageObjects* pObjList, |
133 CPDF_Dictionary* pResources, | 133 CPDF_Dictionary* pResources, |
134 CFX_FloatRect* pBBox, | 134 CFX_FloatRect* pBBox, |
135 CPDF_ParseOptions* pOptions, | 135 CPDF_ParseOptions* pOptions, |
136 CPDF_AllStates* pAllStates, | 136 CPDF_AllStates* pAllStates, |
137 int level); | 137 int level); |
138 ~CPDF_StreamContentParser(); | 138 ~CPDF_StreamContentParser(); |
139 | 139 |
140 FX_BOOL ShouldAbort() const { return m_bAbort; } | 140 bool ShouldAbort() const { return m_bAbort; } |
141 CPDF_PageObjects* GetObjectList() const { return m_pObjectList; } | 141 CPDF_PageObjects* GetObjectList() const { return m_pObjectList; } |
142 CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); } | 142 CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); } |
143 FX_BOOL IsColored() const { return m_bColored; } | 143 bool IsColored() const { return m_bColored; } |
144 const FX_FLOAT* GetType3Data() const { return m_Type3Data; } | 144 const FX_FLOAT* GetType3Data() const { return m_Type3Data; } |
145 | 145 |
146 void AddNumberParam(const FX_CHAR* str, int l
en); | 146 void AddNumberParam(const FX_CHAR* str, int l
en); |
147 void AddObjectParam(CPDF_Object* pObj); | 147 void AddObjectParam(CPDF_Object* pObj); |
148 void AddNameParam(const FX_CHAR* name, int si
ze); | 148 void AddNameParam(const FX_CHAR* name, int si
ze); |
149 int GetNextParamPos(); | 149 int GetNextParamPos(); |
150 void ClearAllParams(); | 150 void ClearAllParams(); |
151 CPDF_Object* GetObject(FX_DWORD index); | 151 CPDF_Object* GetObject(FX_DWORD index); |
152 CFX_ByteString GetString(FX_DWORD index); | 152 CFX_ByteString GetString(FX_DWORD index); |
153 FX_FLOAT GetNumber(FX_DWORD index); | 153 FX_FLOAT GetNumber(FX_DWORD index); |
154 FX_FLOAT GetNumber16(FX_DWORD index); | 154 FX_FLOAT GetNumber16(FX_DWORD index); |
155 int GetInteger(FX_DWORD index) | 155 int GetInteger(FX_DWORD index) |
156 { | 156 { |
157 return (int32_t)(GetNumber(index)); | 157 return (int32_t)(GetNumber(index)); |
158 } | 158 } |
159 FX_BOOL» » » » OnOperator(const FX_CHAR* op); | 159 bool» » » » OnOperator(const FX_CHAR* op); |
160 void BigCaseCaller(int index); | 160 void BigCaseCaller(int index); |
161 FX_DWORD GetParsePos() | 161 FX_DWORD GetParsePos() |
162 { | 162 { |
163 return m_pSyntax->GetPos(); | 163 return m_pSyntax->GetPos(); |
164 } | 164 } |
165 void AddTextObject(CFX_ByteString* pText, FX_
FLOAT fInitKerning, FX_FLOAT* pKerning, int count); | 165 void AddTextObject(CFX_ByteString* pText, FX_
FLOAT fInitKerning, FX_FLOAT* pKerning, int count); |
166 | 166 |
167 void ConvertUserSpace(FX_FLOAT& x, FX_FLOAT&
y); | 167 void ConvertUserSpace(FX_FLOAT& x, FX_FLOAT&
y); |
168 void ConvertTextSpace(FX_FLOAT& x, FX_FLOAT&
y); | 168 void ConvertTextSpace(FX_FLOAT& x, FX_FLOAT&
y); |
169 void OnChangeTextMatrix(); | 169 void OnChangeTextMatrix(); |
170 FX_DWORD Parse(const uint8_t* pData, FX_DWORD dwSize, FX_
DWORD max_cost); | 170 FX_DWORD Parse(const uint8_t* pData, FX_DWORD dwSize, FX_
DWORD max_cost); |
171 void ParsePathObject(); | 171 void ParsePathObject(); |
172 void AddPathPoint(FX_FLOAT x, FX_FLOAT y, int
flag); | 172 void AddPathPoint(FX_FLOAT x, FX_FLOAT y, int
flag); |
173 void AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_F
LOAT w, FX_FLOAT h); | 173 void AddPathRect(FX_FLOAT x, FX_FLOAT y, FX_F
LOAT w, FX_FLOAT h); |
174 void» » » » AddPathObject(int FillType, FX_BOOL bStr
oke); | 174 void» » » » AddPathObject(int FillType, bool bStroke
); |
175 CPDF_ImageObject*» AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BO
OL bInline); | 175 CPDF_ImageObject*» AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, bool
bInline); |
176 void AddDuplicateImage(); | 176 void AddDuplicateImage(); |
177 void AddForm(CPDF_Stream*); | 177 void AddForm(CPDF_Stream*); |
178 void» » » » SetGraphicStates(CPDF_PageObject* pObj,
FX_BOOL bColor, FX_BOOL bText, FX_BOOL bGraph); | 178 void» » » » SetGraphicStates(CPDF_PageObject* pObj,
bool bColor, bool bText, bool bGraph); |
179 void SaveStates(CPDF_AllStates*); | 179 void SaveStates(CPDF_AllStates*); |
180 void RestoreStates(CPDF_AllStates*); | 180 void RestoreStates(CPDF_AllStates*); |
181 CPDF_Font* FindFont(const CFX_ByteString& name); | 181 CPDF_Font* FindFont(const CFX_ByteString& name); |
182 CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name); | 182 CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name); |
183 CPDF_Pattern*» » FindPattern(const CFX_ByteString& name, FX_BOOL
bShading); | 183 CPDF_Pattern*» » FindPattern(const CFX_ByteString& name, bool bSh
ading); |
184 CPDF_Object* FindResourceObj(const CFX_ByteStringC& type, con
st CFX_ByteString& name); | 184 CPDF_Object* FindResourceObj(const CFX_ByteStringC& type, con
st CFX_ByteString& name); |
185 | 185 |
186 protected: | 186 protected: |
187 struct OpCode { | 187 struct OpCode { |
188 FX_DWORD m_OpId; | 188 FX_DWORD m_OpId; |
189 void (CPDF_StreamContentParser::*m_OpHandler)(); | 189 void (CPDF_StreamContentParser::*m_OpHandler)(); |
190 }; | 190 }; |
191 static const OpCode g_OpCodes[]; | 191 static const OpCode g_OpCodes[]; |
192 | 192 |
193 void Handle_CloseFillStrokePath(); | 193 void Handle_CloseFillStrokePath(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 CPDF_Dictionary* m_pParentResources; | 270 CPDF_Dictionary* m_pParentResources; |
271 CPDF_Dictionary* m_pResources; | 271 CPDF_Dictionary* m_pResources; |
272 CPDF_PageObjects* m_pObjectList; | 272 CPDF_PageObjects* m_pObjectList; |
273 int m_Level; | 273 int m_Level; |
274 CFX_AffineMatrix m_mtContentToUser; | 274 CFX_AffineMatrix m_mtContentToUser; |
275 CFX_FloatRect m_BBox; | 275 CFX_FloatRect m_BBox; |
276 CPDF_ParseOptions m_Options; | 276 CPDF_ParseOptions m_Options; |
277 _ContentParam m_ParamBuf1[PARAM_BUF_SIZE]; | 277 _ContentParam m_ParamBuf1[PARAM_BUF_SIZE]; |
278 FX_DWORD m_ParamStartPos; | 278 FX_DWORD m_ParamStartPos; |
279 FX_DWORD m_ParamCount; | 279 FX_DWORD m_ParamCount; |
280 FX_BOOL m_bAbort; | 280 bool m_bAbort; |
281 CPDF_StreamParser* m_pSyntax; | 281 CPDF_StreamParser* m_pSyntax; |
282 nonstd::unique_ptr<CPDF_AllStates> m_pCurStates; | 282 nonstd::unique_ptr<CPDF_AllStates> m_pCurStates; |
283 CPDF_ContentMark m_CurContentMark; | 283 CPDF_ContentMark m_CurContentMark; |
284 CFX_PtrArray m_ClipTextList; | 284 CFX_PtrArray m_ClipTextList; |
285 CPDF_TextObject* m_pLastTextObject; | 285 CPDF_TextObject* m_pLastTextObject; |
286 FX_FLOAT m_DefFontSize; | 286 FX_FLOAT m_DefFontSize; |
287 int m_CompatCount; | 287 int m_CompatCount; |
288 FX_PATHPOINT* m_pPathPoints; | 288 FX_PATHPOINT* m_pPathPoints; |
289 int m_PathPointCount; | 289 int m_PathPointCount; |
290 int m_PathAllocSize; | 290 int m_PathAllocSize; |
291 FX_FLOAT m_PathStartX; | 291 FX_FLOAT m_PathStartX; |
292 FX_FLOAT m_PathStartY; | 292 FX_FLOAT m_PathStartY; |
293 FX_FLOAT m_PathCurrentX; | 293 FX_FLOAT m_PathCurrentX; |
294 FX_FLOAT m_PathCurrentY; | 294 FX_FLOAT m_PathCurrentY; |
295 int m_PathClipType; | 295 int m_PathClipType; |
296 CFX_ByteString m_LastImageName; | 296 CFX_ByteString m_LastImageName; |
297 CPDF_Image* m_pLastImage; | 297 CPDF_Image* m_pLastImage; |
298 CFX_BinaryBuf m_LastImageDict; | 298 CFX_BinaryBuf m_LastImageDict; |
299 CFX_BinaryBuf m_LastImageData; | 299 CFX_BinaryBuf m_LastImageData; |
300 CPDF_Dictionary* m_pLastImageDict; | 300 CPDF_Dictionary* m_pLastImageDict; |
301 CPDF_Dictionary* m_pLastCloneImageDict; | 301 CPDF_Dictionary* m_pLastCloneImageDict; |
302 FX_BOOL m_bReleaseLastDict; | 302 bool m_bReleaseLastDict; |
303 FX_BOOL m_bSameLastDict; | 303 bool m_bSameLastDict; |
304 FX_BOOL m_bColored; | 304 bool m_bColored; |
305 FX_FLOAT m_Type3Data[6]; | 305 FX_FLOAT m_Type3Data[6]; |
306 FX_BOOL m_bResourceMissing; | 306 bool m_bResourceMissing; |
307 CFX_PtrArray m_StateStack; | 307 CFX_PtrArray m_StateStack; |
308 }; | 308 }; |
309 class CPDF_ContentParser | 309 class CPDF_ContentParser |
310 { | 310 { |
311 public: | 311 public: |
312 CPDF_ContentParser(); | 312 CPDF_ContentParser(); |
313 ~CPDF_ContentParser(); | 313 ~CPDF_ContentParser(); |
314 typedef enum { Ready, ToBeContinued, Done } ParseStatus; | 314 typedef enum { Ready, ToBeContinued, Done } ParseStatus; |
315 ParseStatus GetStatus() | 315 ParseStatus GetStatus() |
316 { | 316 { |
317 return m_Status; | 317 return m_Status; |
318 } | 318 } |
319 void Start(CPDF_Page* pPage, CPDF_ParseOption
s* pOptions); | 319 void Start(CPDF_Page* pPage, CPDF_ParseOption
s* pOptions); |
320 void Start(CPDF_Form* pForm, CPDF_AllStates*
pGraphicStates, CFX_AffineMatrix* pParentMatrix, | 320 void Start(CPDF_Form* pForm, CPDF_AllStates*
pGraphicStates, CFX_AffineMatrix* pParentMatrix, |
321 CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOp
tions, int level); | 321 CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOp
tions, int level); |
322 void Continue(IFX_Pause* pPause); | 322 void Continue(IFX_Pause* pPause); |
323 int EstimateProgress(); | 323 int EstimateProgress(); |
324 protected: | 324 protected: |
325 void Clear(); | 325 void Clear(); |
326 ParseStatus m_Status; | 326 ParseStatus m_Status; |
327 CPDF_PageObjects* m_pObjects; | 327 CPDF_PageObjects* m_pObjects; |
328 FX_BOOL» » » » m_bForm; | 328 bool» » » » m_bForm; |
329 CPDF_ParseOptions m_Options; | 329 CPDF_ParseOptions m_Options; |
330 CPDF_Type3Char* m_pType3Char; | 330 CPDF_Type3Char* m_pType3Char; |
331 int m_InternalStage; | 331 int m_InternalStage; |
332 CPDF_StreamAcc* m_pSingleStream; | 332 CPDF_StreamAcc* m_pSingleStream; |
333 CPDF_StreamAcc** m_pStreamArray; | 333 CPDF_StreamAcc** m_pStreamArray; |
334 FX_DWORD m_nStreams; | 334 FX_DWORD m_nStreams; |
335 uint8_t* m_pData; | 335 uint8_t* m_pData; |
336 FX_DWORD m_Size; | 336 FX_DWORD m_Size; |
337 class CPDF_StreamContentParser* m_pParser; | 337 class CPDF_StreamContentParser* m_pParser; |
338 FX_DWORD m_CurrentOffset; | 338 FX_DWORD m_CurrentOffset; |
(...skipping 11 matching lines...) Expand all Loading... |
350 FX_FLOAT m_TextX, m_TextY, m_TextLineX, m_TextLin
eY; | 350 FX_FLOAT m_TextX, m_TextY, m_TextLineX, m_TextLin
eY; |
351 FX_FLOAT m_TextLeading, m_TextRise, m_TextHorzSca
le; | 351 FX_FLOAT m_TextLeading, m_TextRise, m_TextHorzSca
le; |
352 }; | 352 }; |
353 | 353 |
354 class CPDF_DocPageData | 354 class CPDF_DocPageData |
355 { | 355 { |
356 public: | 356 public: |
357 explicit CPDF_DocPageData(CPDF_Document *pPDFDoc); | 357 explicit CPDF_DocPageData(CPDF_Document *pPDFDoc); |
358 ~CPDF_DocPageData(); | 358 ~CPDF_DocPageData(); |
359 | 359 |
360 void Clear(FX_BOOL bRelease = FALSE); | 360 void Clear(bool bRelease = false); |
361 CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, FX_BOOL find
Only); | 361 CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, bool findOnl
y); |
362 CPDF_Font* GetStandardFont(const CFX_ByteStringC& fontName,
CPDF_FontEncoding* pEncoding); | 362 CPDF_Font* GetStandardFont(const CFX_ByteStringC& fontName,
CPDF_FontEncoding* pEncoding); |
363 void ReleaseFont(CPDF_Dictionary* pFontDict); | 363 void ReleaseFont(CPDF_Dictionary* pFontDict); |
364 CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, CPDF_Dictiona
ry* pResources); | 364 CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, CPDF_Dictiona
ry* pResources); |
365 CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); | 365 CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); |
366 void ReleaseColorSpace(CPDF_Object* pColorSpace); | 366 void ReleaseColorSpace(CPDF_Object* pColorSpace); |
367 CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, FX_BOOL bSh
ading, const CFX_AffineMatrix* matrix); | 367 CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, bool bShadi
ng, const CFX_AffineMatrix* matrix); |
368 void ReleasePattern(CPDF_Object* pPatternObj); | 368 void ReleasePattern(CPDF_Object* pPatternObj); |
369 CPDF_Image* GetImage(CPDF_Object* pImageStream); | 369 CPDF_Image* GetImage(CPDF_Object* pImageStream); |
370 void ReleaseImage(CPDF_Object* pImageStream); | 370 void ReleaseImage(CPDF_Object* pImageStream); |
371 CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream); | 371 CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream); |
372 void ReleaseIccProfile(CPDF_IccProfile* pIccProfile); | 372 void ReleaseIccProfile(CPDF_IccProfile* pIccProfile); |
373 CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream); | 373 CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream); |
374 void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStrea
m, FX_BOOL bForce = FALSE); | 374 void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStrea
m, bool bForce = false); |
375 FX_BOOL IsForceClear() const {return m_bForceClear;} | 375 bool IsForceClear() const {return m_bForceClear;} |
376 CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; | 376 CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; |
377 CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; | 377 CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; |
378 | 378 |
379 private: | 379 private: |
380 using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font>; | 380 using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font>; |
381 using CPDF_CountedIccProfile = CPDF_CountedObject<CPDF_IccProfile>; | 381 using CPDF_CountedIccProfile = CPDF_CountedObject<CPDF_IccProfile>; |
382 using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image>; | 382 using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image>; |
383 using CPDF_CountedStreamAcc = CPDF_CountedObject<CPDF_StreamAcc>; | 383 using CPDF_CountedStreamAcc = CPDF_CountedObject<CPDF_StreamAcc>; |
384 | 384 |
385 using CPDF_ColorSpaceMap = std::map<CPDF_Object*, CPDF_CountedColorSpace*>; | 385 using CPDF_ColorSpaceMap = std::map<CPDF_Object*, CPDF_CountedColorSpace*>; |
386 using CPDF_FontFileMap = std::map<CPDF_Stream*, CPDF_CountedStreamAcc*>; | 386 using CPDF_FontFileMap = std::map<CPDF_Stream*, CPDF_CountedStreamAcc*>; |
387 using CPDF_FontMap = std::map<CPDF_Dictionary*, CPDF_CountedFont*>; | 387 using CPDF_FontMap = std::map<CPDF_Dictionary*, CPDF_CountedFont*>; |
388 using CPDF_IccProfileMap = std::map<CPDF_Stream*, CPDF_CountedIccProfile*>; | 388 using CPDF_IccProfileMap = std::map<CPDF_Stream*, CPDF_CountedIccProfile*>; |
389 using CPDF_ImageMap = std::map<FX_DWORD, CPDF_CountedImage*>; | 389 using CPDF_ImageMap = std::map<FX_DWORD, CPDF_CountedImage*>; |
390 using CPDF_PatternMap = std::map<CPDF_Object*, CPDF_CountedPattern*>; | 390 using CPDF_PatternMap = std::map<CPDF_Object*, CPDF_CountedPattern*>; |
391 | 391 |
392 CPDF_Document* const m_pPDFDoc; | 392 CPDF_Document* const m_pPDFDoc; |
393 CFX_MapByteStringToPtr m_HashProfileMap; | 393 CFX_MapByteStringToPtr m_HashProfileMap; |
394 FX_BOOL m_bForceClear; | 394 bool m_bForceClear; |
395 | 395 |
396 CPDF_ColorSpaceMap m_ColorSpaceMap; | 396 CPDF_ColorSpaceMap m_ColorSpaceMap; |
397 CPDF_FontFileMap m_FontFileMap; | 397 CPDF_FontFileMap m_FontFileMap; |
398 CPDF_FontMap m_FontMap; | 398 CPDF_FontMap m_FontMap; |
399 CPDF_IccProfileMap m_IccProfileMap; | 399 CPDF_IccProfileMap m_IccProfileMap; |
400 CPDF_ImageMap m_ImageMap; | 400 CPDF_ImageMap m_ImageMap; |
401 CPDF_PatternMap m_PatternMap; | 401 CPDF_PatternMap m_PatternMap; |
402 }; | 402 }; |
403 | 403 |
404 class CPDF_Function | 404 class CPDF_Function |
405 { | 405 { |
406 public: | 406 public: |
407 static CPDF_Function* Load(CPDF_Object* pFuncObj); | 407 static CPDF_Function* Load(CPDF_Object* pFuncObj); |
408 virtual ~CPDF_Function(); | 408 virtual ~CPDF_Function(); |
409 FX_BOOL» » Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, i
nt& nresults) const; | 409 bool» » Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, i
nt& nresults) const; |
410 int CountInputs() | 410 int CountInputs() |
411 { | 411 { |
412 return m_nInputs; | 412 return m_nInputs; |
413 } | 413 } |
414 int CountOutputs() | 414 int CountOutputs() |
415 { | 415 { |
416 return m_nOutputs; | 416 return m_nOutputs; |
417 } | 417 } |
418 protected: | 418 protected: |
419 CPDF_Function(); | 419 CPDF_Function(); |
420 int m_nInputs, m_nOutputs; | 420 int m_nInputs, m_nOutputs; |
421 FX_FLOAT* m_pDomains; | 421 FX_FLOAT* m_pDomains; |
422 FX_FLOAT* m_pRanges; | 422 FX_FLOAT* m_pRanges; |
423 FX_BOOL» » Init(CPDF_Object* pObj); | 423 bool» » Init(CPDF_Object* pObj); |
424 virtual FX_BOOL» v_Init(CPDF_Object* pObj) = 0; | 424 virtual bool» v_Init(CPDF_Object* pObj) = 0; |
425 virtual FX_BOOL» v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; | 425 virtual bool» v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; |
426 }; | 426 }; |
427 class CPDF_IccProfile | 427 class CPDF_IccProfile |
428 { | 428 { |
429 public: | 429 public: |
430 CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); | 430 CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); |
431 ~CPDF_IccProfile(); | 431 ~CPDF_IccProfile(); |
432 int32_t GetComponents() const { return m_nSrcComponents; } | 432 int32_t GetComponents() const { return m_nSrcComponents; } |
433 FX_BOOL» » » » » m_bsRGB; | 433 bool» » » » » m_bsRGB; |
434 void* m_pTransform; | 434 void* m_pTransform; |
435 private: | 435 private: |
436 int32_t m_nSrcComponents; | 436 int32_t m_nSrcComponents; |
437 }; | 437 }; |
438 | 438 |
439 class CPDF_DeviceCS : public CPDF_ColorSpace | 439 class CPDF_DeviceCS : public CPDF_ColorSpace |
440 { | 440 { |
441 public: | 441 public: |
442 CPDF_DeviceCS(CPDF_Document* pDoc, int family); | 442 CPDF_DeviceCS(CPDF_Document* pDoc, int family); |
443 | 443 |
444 FX_BOOL GetRGB(FX_FLOAT* pBuf, | 444 bool GetRGB(FX_FLOAT* pBuf, |
445 FX_FLOAT& R, | 445 FX_FLOAT& R, |
446 FX_FLOAT& G, | 446 FX_FLOAT& G, |
447 FX_FLOAT& B) const override; | 447 FX_FLOAT& B) const override; |
448 FX_BOOL SetRGB(FX_FLOAT* pBuf, | 448 bool SetRGB(FX_FLOAT* pBuf, |
449 FX_FLOAT R, | 449 FX_FLOAT R, |
450 FX_FLOAT G, | 450 FX_FLOAT G, |
451 FX_FLOAT B) const override; | 451 FX_FLOAT B) const override; |
452 FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, | 452 bool v_GetCMYK(FX_FLOAT* pBuf, |
453 FX_FLOAT& c, | 453 FX_FLOAT& c, |
454 FX_FLOAT& m, | 454 FX_FLOAT& m, |
455 FX_FLOAT& y, | 455 FX_FLOAT& y, |
456 FX_FLOAT& k) const override; | 456 FX_FLOAT& k) const override; |
457 FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, | 457 bool v_SetCMYK(FX_FLOAT* pBuf, |
458 FX_FLOAT c, | 458 FX_FLOAT c, |
459 FX_FLOAT m, | 459 FX_FLOAT m, |
460 FX_FLOAT y, | 460 FX_FLOAT y, |
461 FX_FLOAT k) const override; | 461 FX_FLOAT k) const override; |
462 void TranslateImageLine(uint8_t* pDestBuf, | 462 void TranslateImageLine(uint8_t* pDestBuf, |
463 const uint8_t* pSrcBuf, | 463 const uint8_t* pSrcBuf, |
464 int pixels, | 464 int pixels, |
465 int image_width, | 465 int image_width, |
466 int image_height, | 466 int image_height, |
467 FX_BOOL bTransMask = FALSE) const override; | 467 bool bTransMask = false) const override; |
468 }; | 468 }; |
469 | 469 |
470 class CPDF_PatternCS : public CPDF_ColorSpace | 470 class CPDF_PatternCS : public CPDF_ColorSpace |
471 { | 471 { |
472 public: | 472 public: |
473 explicit CPDF_PatternCS(CPDF_Document* pDoc) | 473 explicit CPDF_PatternCS(CPDF_Document* pDoc) |
474 : CPDF_ColorSpace(pDoc, PDFCS_PATTERN, 1), | 474 : CPDF_ColorSpace(pDoc, PDFCS_PATTERN, 1), |
475 m_pBaseCS(nullptr), | 475 m_pBaseCS(nullptr), |
476 m_pCountedBaseCS(nullptr) { | 476 m_pCountedBaseCS(nullptr) { |
477 } | 477 } |
478 ~CPDF_PatternCS() override; | 478 ~CPDF_PatternCS() override; |
479 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; | 479 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; |
480 FX_BOOL GetRGB(FX_FLOAT* pBuf, | 480 bool GetRGB(FX_FLOAT* pBuf, |
481 FX_FLOAT& R, | 481 FX_FLOAT& R, |
482 FX_FLOAT& G, | 482 FX_FLOAT& G, |
483 FX_FLOAT& B) const override; | 483 FX_FLOAT& B) const override; |
484 CPDF_ColorSpace* GetBaseCS() const override; | 484 CPDF_ColorSpace* GetBaseCS() const override; |
485 | 485 |
486 private: | 486 private: |
487 CPDF_ColorSpace* m_pBaseCS; | 487 CPDF_ColorSpace* m_pBaseCS; |
488 CPDF_CountedColorSpace* m_pCountedBaseCS; | 488 CPDF_CountedColorSpace* m_pCountedBaseCS; |
489 }; | 489 }; |
490 | 490 |
491 #endif // CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 491 #endif // CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
OLD | NEW |