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 enum ParseStatus { | 312 enum ParseStatus { |
313 Ready, | 313 Ready, |
314 ToBeContinued, | 314 ToBeContinued, |
315 Done | 315 Done |
316 }; | 316 }; |
317 | 317 |
318 CPDF_ContentParser(); | 318 CPDF_ContentParser(); |
319 ~CPDF_ContentParser(); | 319 ~CPDF_ContentParser(); |
320 | 320 |
321 ParseStatus GetStatus() | 321 ParseStatus GetStatus() |
322 { | 322 { |
323 return m_Status; | 323 return m_Status; |
324 } | 324 } |
325 void Start(CPDF_Page* pPage, CPDF_ParseOption
s* pOptions); | 325 void Start(CPDF_Page* pPage, CPDF_ParseOption
s* pOptions); |
326 void Start(CPDF_Form* pForm, CPDF_AllStates*
pGraphicStates, CFX_AffineMatrix* pParentMatrix, | 326 void Start(CPDF_Form* pForm, CPDF_AllStates*
pGraphicStates, CFX_AffineMatrix* pParentMatrix, |
327 CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOp
tions, int level); | 327 CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOp
tions, int level); |
328 void Continue(IFX_Pause* pPause); | 328 void Continue(IFX_Pause* pPause); |
329 | 329 |
330 protected: | 330 protected: |
331 void Clear(); | 331 void Clear(); |
332 ParseStatus m_Status; | 332 ParseStatus m_Status; |
333 CPDF_PageObjects* m_pObjects; | 333 CPDF_PageObjects* m_pObjects; |
334 FX_BOOL» » » » m_bForm; | 334 bool» » » » m_bForm; |
335 CPDF_ParseOptions m_Options; | 335 CPDF_ParseOptions m_Options; |
336 CPDF_Type3Char* m_pType3Char; | 336 CPDF_Type3Char* m_pType3Char; |
337 int m_InternalStage; | 337 int m_InternalStage; |
338 CPDF_StreamAcc* m_pSingleStream; | 338 CPDF_StreamAcc* m_pSingleStream; |
339 CPDF_StreamAcc** m_pStreamArray; | 339 CPDF_StreamAcc** m_pStreamArray; |
340 FX_DWORD m_nStreams; | 340 FX_DWORD m_nStreams; |
341 uint8_t* m_pData; | 341 uint8_t* m_pData; |
342 FX_DWORD m_Size; | 342 FX_DWORD m_Size; |
343 class CPDF_StreamContentParser* m_pParser; | 343 class CPDF_StreamContentParser* m_pParser; |
344 FX_DWORD m_CurrentOffset; | 344 FX_DWORD m_CurrentOffset; |
(...skipping 11 matching lines...) Expand all Loading... |
356 FX_FLOAT m_TextX, m_TextY, m_TextLineX, m_TextLin
eY; | 356 FX_FLOAT m_TextX, m_TextY, m_TextLineX, m_TextLin
eY; |
357 FX_FLOAT m_TextLeading, m_TextRise, m_TextHorzSca
le; | 357 FX_FLOAT m_TextLeading, m_TextRise, m_TextHorzSca
le; |
358 }; | 358 }; |
359 | 359 |
360 class CPDF_DocPageData | 360 class CPDF_DocPageData |
361 { | 361 { |
362 public: | 362 public: |
363 explicit CPDF_DocPageData(CPDF_Document *pPDFDoc); | 363 explicit CPDF_DocPageData(CPDF_Document *pPDFDoc); |
364 ~CPDF_DocPageData(); | 364 ~CPDF_DocPageData(); |
365 | 365 |
366 void Clear(FX_BOOL bRelease = FALSE); | 366 void Clear(bool bRelease = false); |
367 CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, FX_BOOL find
Only); | 367 CPDF_Font* GetFont(CPDF_Dictionary* pFontDict, bool findOnl
y); |
368 CPDF_Font* GetStandardFont(const CFX_ByteStringC& fontName,
CPDF_FontEncoding* pEncoding); | 368 CPDF_Font* GetStandardFont(const CFX_ByteStringC& fontName,
CPDF_FontEncoding* pEncoding); |
369 void ReleaseFont(CPDF_Dictionary* pFontDict); | 369 void ReleaseFont(CPDF_Dictionary* pFontDict); |
370 CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, CPDF_Dictiona
ry* pResources); | 370 CPDF_ColorSpace* GetColorSpace(CPDF_Object* pCSObj, CPDF_Dictiona
ry* pResources); |
371 CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); | 371 CPDF_ColorSpace* GetCopiedColorSpace(CPDF_Object* pCSObj); |
372 void ReleaseColorSpace(CPDF_Object* pColorSpace); | 372 void ReleaseColorSpace(CPDF_Object* pColorSpace); |
373 CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, FX_BOOL bSh
ading, const CFX_AffineMatrix* matrix); | 373 CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, bool bShadi
ng, const CFX_AffineMatrix* matrix); |
374 void ReleasePattern(CPDF_Object* pPatternObj); | 374 void ReleasePattern(CPDF_Object* pPatternObj); |
375 CPDF_Image* GetImage(CPDF_Object* pImageStream); | 375 CPDF_Image* GetImage(CPDF_Object* pImageStream); |
376 void ReleaseImage(CPDF_Object* pImageStream); | 376 void ReleaseImage(CPDF_Object* pImageStream); |
377 CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream); | 377 CPDF_IccProfile* GetIccProfile(CPDF_Stream* pIccProfileStream); |
378 void ReleaseIccProfile(CPDF_IccProfile* pIccProfile); | 378 void ReleaseIccProfile(CPDF_IccProfile* pIccProfile); |
379 CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream); | 379 CPDF_StreamAcc* GetFontFileStreamAcc(CPDF_Stream* pFontStream); |
380 void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStrea
m, FX_BOOL bForce = FALSE); | 380 void ReleaseFontFileStreamAcc(CPDF_Stream* pFontStrea
m, bool bForce = false); |
381 FX_BOOL IsForceClear() const {return m_bForceClear;} | 381 bool IsForceClear() const {return m_bForceClear;} |
382 CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; | 382 CPDF_CountedColorSpace* FindColorSpacePtr(CPDF_Object* pCSObj) const; |
383 CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; | 383 CPDF_CountedPattern* FindPatternPtr(CPDF_Object* pPatternObj) const; |
384 | 384 |
385 private: | 385 private: |
386 using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font>; | 386 using CPDF_CountedFont = CPDF_CountedObject<CPDF_Font>; |
387 using CPDF_CountedIccProfile = CPDF_CountedObject<CPDF_IccProfile>; | 387 using CPDF_CountedIccProfile = CPDF_CountedObject<CPDF_IccProfile>; |
388 using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image>; | 388 using CPDF_CountedImage = CPDF_CountedObject<CPDF_Image>; |
389 using CPDF_CountedStreamAcc = CPDF_CountedObject<CPDF_StreamAcc>; | 389 using CPDF_CountedStreamAcc = CPDF_CountedObject<CPDF_StreamAcc>; |
390 | 390 |
391 using CPDF_ColorSpaceMap = std::map<CPDF_Object*, CPDF_CountedColorSpace*>; | 391 using CPDF_ColorSpaceMap = std::map<CPDF_Object*, CPDF_CountedColorSpace*>; |
392 using CPDF_FontFileMap = std::map<CPDF_Stream*, CPDF_CountedStreamAcc*>; | 392 using CPDF_FontFileMap = std::map<CPDF_Stream*, CPDF_CountedStreamAcc*>; |
393 using CPDF_FontMap = std::map<CPDF_Dictionary*, CPDF_CountedFont*>; | 393 using CPDF_FontMap = std::map<CPDF_Dictionary*, CPDF_CountedFont*>; |
394 using CPDF_IccProfileMap = std::map<CPDF_Stream*, CPDF_CountedIccProfile*>; | 394 using CPDF_IccProfileMap = std::map<CPDF_Stream*, CPDF_CountedIccProfile*>; |
395 using CPDF_ImageMap = std::map<FX_DWORD, CPDF_CountedImage*>; | 395 using CPDF_ImageMap = std::map<FX_DWORD, CPDF_CountedImage*>; |
396 using CPDF_PatternMap = std::map<CPDF_Object*, CPDF_CountedPattern*>; | 396 using CPDF_PatternMap = std::map<CPDF_Object*, CPDF_CountedPattern*>; |
397 | 397 |
398 CPDF_Document* const m_pPDFDoc; | 398 CPDF_Document* const m_pPDFDoc; |
399 CFX_MapByteStringToPtr m_HashProfileMap; | 399 CFX_MapByteStringToPtr m_HashProfileMap; |
400 FX_BOOL m_bForceClear; | 400 bool m_bForceClear; |
401 | 401 |
402 CPDF_ColorSpaceMap m_ColorSpaceMap; | 402 CPDF_ColorSpaceMap m_ColorSpaceMap; |
403 CPDF_FontFileMap m_FontFileMap; | 403 CPDF_FontFileMap m_FontFileMap; |
404 CPDF_FontMap m_FontMap; | 404 CPDF_FontMap m_FontMap; |
405 CPDF_IccProfileMap m_IccProfileMap; | 405 CPDF_IccProfileMap m_IccProfileMap; |
406 CPDF_ImageMap m_ImageMap; | 406 CPDF_ImageMap m_ImageMap; |
407 CPDF_PatternMap m_PatternMap; | 407 CPDF_PatternMap m_PatternMap; |
408 }; | 408 }; |
409 | 409 |
410 class CPDF_Function | 410 class CPDF_Function |
411 { | 411 { |
412 public: | 412 public: |
413 static CPDF_Function* Load(CPDF_Object* pFuncObj); | 413 static CPDF_Function* Load(CPDF_Object* pFuncObj); |
414 virtual ~CPDF_Function(); | 414 virtual ~CPDF_Function(); |
415 FX_BOOL» » Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, i
nt& nresults) const; | 415 bool» » Call(FX_FLOAT* inputs, int ninputs, FX_FLOAT* results, i
nt& nresults) const; |
416 int CountInputs() | 416 int CountInputs() |
417 { | 417 { |
418 return m_nInputs; | 418 return m_nInputs; |
419 } | 419 } |
420 int CountOutputs() | 420 int CountOutputs() |
421 { | 421 { |
422 return m_nOutputs; | 422 return m_nOutputs; |
423 } | 423 } |
424 protected: | 424 protected: |
425 CPDF_Function(); | 425 CPDF_Function(); |
426 int m_nInputs, m_nOutputs; | 426 int m_nInputs, m_nOutputs; |
427 FX_FLOAT* m_pDomains; | 427 FX_FLOAT* m_pDomains; |
428 FX_FLOAT* m_pRanges; | 428 FX_FLOAT* m_pRanges; |
429 FX_BOOL» » Init(CPDF_Object* pObj); | 429 bool» » Init(CPDF_Object* pObj); |
430 virtual FX_BOOL» v_Init(CPDF_Object* pObj) = 0; | 430 virtual bool» v_Init(CPDF_Object* pObj) = 0; |
431 virtual FX_BOOL» v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; | 431 virtual bool» v_Call(FX_FLOAT* inputs, FX_FLOAT* results) const = 0; |
432 }; | 432 }; |
433 class CPDF_IccProfile | 433 class CPDF_IccProfile |
434 { | 434 { |
435 public: | 435 public: |
436 CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); | 436 CPDF_IccProfile(const uint8_t* pData, FX_DWORD dwSize); |
437 ~CPDF_IccProfile(); | 437 ~CPDF_IccProfile(); |
438 int32_t GetComponents() const { return m_nSrcComponents; } | 438 int32_t GetComponents() const { return m_nSrcComponents; } |
439 FX_BOOL» » » » » m_bsRGB; | 439 bool» » » » » m_bsRGB; |
440 void* m_pTransform; | 440 void* m_pTransform; |
441 private: | 441 private: |
442 int32_t m_nSrcComponents; | 442 int32_t m_nSrcComponents; |
443 }; | 443 }; |
444 | 444 |
445 class CPDF_DeviceCS : public CPDF_ColorSpace | 445 class CPDF_DeviceCS : public CPDF_ColorSpace |
446 { | 446 { |
447 public: | 447 public: |
448 CPDF_DeviceCS(CPDF_Document* pDoc, int family); | 448 CPDF_DeviceCS(CPDF_Document* pDoc, int family); |
449 | 449 |
450 FX_BOOL GetRGB(FX_FLOAT* pBuf, | 450 bool GetRGB(FX_FLOAT* pBuf, |
451 FX_FLOAT& R, | 451 FX_FLOAT& R, |
452 FX_FLOAT& G, | 452 FX_FLOAT& G, |
453 FX_FLOAT& B) const override; | 453 FX_FLOAT& B) const override; |
454 FX_BOOL SetRGB(FX_FLOAT* pBuf, | 454 bool SetRGB(FX_FLOAT* pBuf, |
455 FX_FLOAT R, | 455 FX_FLOAT R, |
456 FX_FLOAT G, | 456 FX_FLOAT G, |
457 FX_FLOAT B) const override; | 457 FX_FLOAT B) const override; |
458 FX_BOOL v_GetCMYK(FX_FLOAT* pBuf, | 458 bool v_GetCMYK(FX_FLOAT* pBuf, |
459 FX_FLOAT& c, | 459 FX_FLOAT& c, |
460 FX_FLOAT& m, | 460 FX_FLOAT& m, |
461 FX_FLOAT& y, | 461 FX_FLOAT& y, |
462 FX_FLOAT& k) const override; | 462 FX_FLOAT& k) const override; |
463 FX_BOOL v_SetCMYK(FX_FLOAT* pBuf, | 463 bool v_SetCMYK(FX_FLOAT* pBuf, |
464 FX_FLOAT c, | 464 FX_FLOAT c, |
465 FX_FLOAT m, | 465 FX_FLOAT m, |
466 FX_FLOAT y, | 466 FX_FLOAT y, |
467 FX_FLOAT k) const override; | 467 FX_FLOAT k) const override; |
468 void TranslateImageLine(uint8_t* pDestBuf, | 468 void TranslateImageLine(uint8_t* pDestBuf, |
469 const uint8_t* pSrcBuf, | 469 const uint8_t* pSrcBuf, |
470 int pixels, | 470 int pixels, |
471 int image_width, | 471 int image_width, |
472 int image_height, | 472 int image_height, |
473 FX_BOOL bTransMask = FALSE) const override; | 473 bool bTransMask = false) const override; |
474 }; | 474 }; |
475 | 475 |
476 class CPDF_PatternCS : public CPDF_ColorSpace | 476 class CPDF_PatternCS : public CPDF_ColorSpace |
477 { | 477 { |
478 public: | 478 public: |
479 explicit CPDF_PatternCS(CPDF_Document* pDoc) | 479 explicit CPDF_PatternCS(CPDF_Document* pDoc) |
480 : CPDF_ColorSpace(pDoc, PDFCS_PATTERN, 1), | 480 : CPDF_ColorSpace(pDoc, PDFCS_PATTERN, 1), |
481 m_pBaseCS(nullptr), | 481 m_pBaseCS(nullptr), |
482 m_pCountedBaseCS(nullptr) { | 482 m_pCountedBaseCS(nullptr) { |
483 } | 483 } |
484 ~CPDF_PatternCS() override; | 484 ~CPDF_PatternCS() override; |
485 FX_BOOL v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; | 485 bool v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) override; |
486 FX_BOOL GetRGB(FX_FLOAT* pBuf, | 486 bool GetRGB(FX_FLOAT* pBuf, |
487 FX_FLOAT& R, | 487 FX_FLOAT& R, |
488 FX_FLOAT& G, | 488 FX_FLOAT& G, |
489 FX_FLOAT& B) const override; | 489 FX_FLOAT& B) const override; |
490 CPDF_ColorSpace* GetBaseCS() const override; | 490 CPDF_ColorSpace* GetBaseCS() const override; |
491 | 491 |
492 private: | 492 private: |
493 CPDF_ColorSpace* m_pBaseCS; | 493 CPDF_ColorSpace* m_pBaseCS; |
494 CPDF_CountedColorSpace* m_pCountedBaseCS; | 494 CPDF_CountedColorSpace* m_pCountedBaseCS; |
495 }; | 495 }; |
496 | 496 |
497 #endif // CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ | 497 #endif // CORE_SRC_FPDFAPI_FPDF_PAGE_PAGEINT_H_ |
OLD | NEW |