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 #include "../../../include/fpdfapi/fpdf_page.h" | 7 #include "../../../include/fpdfapi/fpdf_page.h" |
8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include "pageint.h" | 10 #include "pageint.h" |
11 #include <limits.h> | 11 #include <limits.h> |
12 const FX_CHAR* const _PDF_OpCharType = | 12 const FX_CHAR* const _PDF_OpCharType = |
13 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" | 13 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" |
14 "IIVIIIIVIIVIIIIIVVIIIIIIIIIIIIII" | 14 "IIVIIIIVIIVIIIIIVVIIIIIIIIIIIIII" |
15 "IIVVVVVVIVVVVVVIVVVVVIIVVIIIIIII" | 15 "IIVVVVVVIVVVVVVIVVVVVIIVVIIIIIII" |
16 "IIVVVVVVVVVVVVVVIVVVIIVVIVVIIIII" | 16 "IIVVVVVVVVVVVVVVIVVVIIVVIVVIIIII" |
17 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" | 17 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" |
18 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" | 18 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" |
19 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" | 19 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII" |
20 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"; | 20 "IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII"; |
21 FX_BOOL _PDF_HasInvalidOpChar(const FX_CHAR* op) | 21 bool _PDF_HasInvalidOpChar(const FX_CHAR* op) |
22 { | 22 { |
23 if(!op) { | 23 if(!op) { |
24 return FALSE; | 24 return false; |
25 } | 25 } |
26 uint8_t ch; | 26 uint8_t ch; |
27 while((ch = *op++)) { | 27 while((ch = *op++)) { |
28 if(_PDF_OpCharType[ch] == 'I') { | 28 if(_PDF_OpCharType[ch] == 'I') { |
29 return TRUE; | 29 return true; |
30 } | 30 } |
31 } | 31 } |
32 return FALSE; | 32 return false; |
33 } | 33 } |
34 class CPDF_StreamParserAutoClearer { | 34 class CPDF_StreamParserAutoClearer { |
35 public: | 35 public: |
36 CPDF_StreamParserAutoClearer(CPDF_StreamParser** scoped_variable, CPDF_Strea
mParser* new_parser) | 36 CPDF_StreamParserAutoClearer(CPDF_StreamParser** scoped_variable, CPDF_Strea
mParser* new_parser) |
37 : scoped_variable_(scoped_variable) { | 37 : scoped_variable_(scoped_variable) { |
38 *scoped_variable_ = new_parser; | 38 *scoped_variable_ = new_parser; |
39 } | 39 } |
40 ~CPDF_StreamParserAutoClearer() { *scoped_variable_ = NULL; } | 40 ~CPDF_StreamParserAutoClearer() { *scoped_variable_ = NULL; } |
41 private: | 41 private: |
42 CPDF_StreamParser** scoped_variable_; | 42 CPDF_StreamParser** scoped_variable_; |
(...skipping 10 matching lines...) Expand all Loading... |
53 while (1) { | 53 while (1) { |
54 FX_DWORD cost = m_pObjectList->CountObjects() - InitObjCount; | 54 FX_DWORD cost = m_pObjectList->CountObjects() - InitObjCount; |
55 if (max_cost && cost >= max_cost) { | 55 if (max_cost && cost >= max_cost) { |
56 break; | 56 break; |
57 } | 57 } |
58 switch (syntax.ParseNextElement()) { | 58 switch (syntax.ParseNextElement()) { |
59 case CPDF_StreamParser::EndOfData: | 59 case CPDF_StreamParser::EndOfData: |
60 return m_pSyntax->GetPos(); | 60 return m_pSyntax->GetPos(); |
61 case CPDF_StreamParser::Keyword: | 61 case CPDF_StreamParser::Keyword: |
62 if(!OnOperator((char*)syntax.GetWordBuf()) && _PDF_HasInvalidOpC
har((char*)syntax.GetWordBuf())) { | 62 if(!OnOperator((char*)syntax.GetWordBuf()) && _PDF_HasInvalidOpC
har((char*)syntax.GetWordBuf())) { |
63 m_bAbort = TRUE; | 63 m_bAbort = true; |
64 } | 64 } |
65 if (m_bAbort) { | 65 if (m_bAbort) { |
66 return m_pSyntax->GetPos(); | 66 return m_pSyntax->GetPos(); |
67 } | 67 } |
68 ClearAllParams(); | 68 ClearAllParams(); |
69 break; | 69 break; |
70 case CPDF_StreamParser::Number: | 70 case CPDF_StreamParser::Number: |
71 AddNumberParam((char*)syntax.GetWordBuf(), syntax.GetWordSize())
; | 71 AddNumberParam((char*)syntax.GetWordBuf(), syntax.GetWordSize())
; |
72 break; | 72 break; |
73 case CPDF_StreamParser::Name: | 73 case CPDF_StreamParser::Name: |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 if (m_Options.m_bTextOnly) { | 137 if (m_Options.m_bTextOnly) { |
138 if (pStream) { | 138 if (pStream) { |
139 pStream->Release(); | 139 pStream->Release(); |
140 } else { | 140 } else { |
141 pDict->Release(); | 141 pDict->Release(); |
142 } | 142 } |
143 return; | 143 return; |
144 } | 144 } |
145 pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); | 145 pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); |
146 CPDF_ImageObject *pImgObj = AddImage(pStream, NULL, TRUE); | 146 CPDF_ImageObject *pImgObj = AddImage(pStream, NULL, true); |
147 if (!pImgObj) { | 147 if (!pImgObj) { |
148 if (pStream) { | 148 if (pStream) { |
149 pStream->Release(); | 149 pStream->Release(); |
150 } else { | 150 } else { |
151 pDict->Release(); | 151 pDict->Release(); |
152 } | 152 } |
153 } | 153 } |
154 } | 154 } |
155 void CPDF_StreamContentParser::ParsePathObject() | 155 void CPDF_StreamContentParser::ParsePathObject() |
156 { | 156 { |
157 FX_FLOAT params[6] = {}; | 157 FX_FLOAT params[6] = {}; |
158 int nParams = 0; | 158 int nParams = 0; |
159 int last_pos = m_pSyntax->GetPos(); | 159 int last_pos = m_pSyntax->GetPos(); |
160 while (1) { | 160 while (1) { |
161 CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement(); | 161 CPDF_StreamParser::SyntaxType type = m_pSyntax->ParseNextElement(); |
162 FX_BOOL bProcessed = TRUE; | 162 bool bProcessed = true; |
163 switch (type) { | 163 switch (type) { |
164 case CPDF_StreamParser::EndOfData: | 164 case CPDF_StreamParser::EndOfData: |
165 return; | 165 return; |
166 case CPDF_StreamParser::Keyword: { | 166 case CPDF_StreamParser::Keyword: { |
167 int len = m_pSyntax->GetWordSize(); | 167 int len = m_pSyntax->GetWordSize(); |
168 if (len == 1) { | 168 if (len == 1) { |
169 switch (m_pSyntax->GetWordBuf()[0]) { | 169 switch (m_pSyntax->GetWordBuf()[0]) { |
170 case 'm': | 170 case 'm': |
171 AddPathPoint(params[0], params[1], FXPT_MOVETO); | 171 AddPathPoint(params[0], params[1], FXPT_MOVETO); |
172 nParams = 0; | 172 nParams = 0; |
(...skipping 18 matching lines...) Expand all Loading... |
191 AddPathPoint(params[0], params[1], FXPT_BEZIERTO
); | 191 AddPathPoint(params[0], params[1], FXPT_BEZIERTO
); |
192 AddPathPoint(params[2], params[3], FXPT_BEZIERTO
); | 192 AddPathPoint(params[2], params[3], FXPT_BEZIERTO
); |
193 AddPathPoint(params[2], params[3], FXPT_BEZIERTO
); | 193 AddPathPoint(params[2], params[3], FXPT_BEZIERTO
); |
194 nParams = 0; | 194 nParams = 0; |
195 break; | 195 break; |
196 case 'h': | 196 case 'h': |
197 Handle_ClosePath(); | 197 Handle_ClosePath(); |
198 nParams = 0; | 198 nParams = 0; |
199 break; | 199 break; |
200 default: | 200 default: |
201 bProcessed = FALSE; | 201 bProcessed = false; |
202 break; | 202 break; |
203 } | 203 } |
204 } else if (len == 2) { | 204 } else if (len == 2) { |
205 if (m_pSyntax->GetWordBuf()[0] == 'r' && m_pSyntax->GetW
ordBuf()[1] == 'e') { | 205 if (m_pSyntax->GetWordBuf()[0] == 'r' && m_pSyntax->GetW
ordBuf()[1] == 'e') { |
206 AddPathRect(params[0], params[1], params[2], params[
3]); | 206 AddPathRect(params[0], params[1], params[2], params[
3]); |
207 nParams = 0; | 207 nParams = 0; |
208 } else { | 208 } else { |
209 bProcessed = FALSE; | 209 bProcessed = false; |
210 } | 210 } |
211 } else { | 211 } else { |
212 bProcessed = FALSE; | 212 bProcessed = false; |
213 } | 213 } |
214 if (bProcessed) { | 214 if (bProcessed) { |
215 last_pos = m_pSyntax->GetPos(); | 215 last_pos = m_pSyntax->GetPos(); |
216 } | 216 } |
217 break; | 217 break; |
218 } | 218 } |
219 case CPDF_StreamParser::Number: { | 219 case CPDF_StreamParser::Number: { |
220 if (nParams == 6) { | 220 if (nParams == 6) { |
221 break; | 221 break; |
222 } | 222 } |
223 FX_BOOL bInteger; | 223 bool bInteger; |
224 int value; | 224 int value; |
225 FX_atonum(CFX_ByteStringC(m_pSyntax->GetWordBuf(), m_pSyntax
->GetWordSize()), bInteger, &value); | 225 FX_atonum(CFX_ByteStringC(m_pSyntax->GetWordBuf(), m_pSyntax
->GetWordSize()), bInteger, &value); |
226 params[nParams++] = bInteger ? (FX_FLOAT)value : *(FX_FLOAT*
)&value; | 226 params[nParams++] = bInteger ? (FX_FLOAT)value : *(FX_FLOAT*
)&value; |
227 break; | 227 break; |
228 } | 228 } |
229 default: | 229 default: |
230 bProcessed = FALSE; | 230 bProcessed = false; |
231 } | 231 } |
232 if (!bProcessed) { | 232 if (!bProcessed) { |
233 m_pSyntax->SetPos(last_pos); | 233 m_pSyntax->SetPos(last_pos); |
234 return; | 234 return; |
235 } | 235 } |
236 } | 236 } |
237 } | 237 } |
238 CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize) | 238 CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, FX_DWORD dwSize) |
239 { | 239 { |
240 m_pBuf = pData; | 240 m_pBuf = pData; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 FXSYS_memcpy(dest_buf + row * pitch, pLine, pitch); | 272 FXSYS_memcpy(dest_buf + row * pitch, pLine, pitch); |
273 } | 273 } |
274 FX_DWORD srcoff = pDecoder->GetSrcOffset(); | 274 FX_DWORD srcoff = pDecoder->GetSrcOffset(); |
275 delete pDecoder; | 275 delete pDecoder; |
276 return srcoff; | 276 return srcoff; |
277 } | 277 } |
278 ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWOR
D src_size, int width, int height, | 278 ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(const uint8_t* src_buf, FX_DWOR
D src_size, int width, int height, |
279 const CPDF_Dictionary* pParams); | 279 const CPDF_Dictionary* pParams); |
280 FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_bu
f, FX_DWORD& dest_size); | 280 FX_DWORD _A85Decode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_bu
f, FX_DWORD& dest_size); |
281 FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_bu
f, FX_DWORD& dest_size); | 281 FX_DWORD _HexDecode(const uint8_t* src_buf, FX_DWORD src_size, uint8_t*& dest_bu
f, FX_DWORD& dest_size); |
282 FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, const uint8_t* src_buf, FX_DWORD
src_size, CPDF_Dictionary* pParams, | 282 FX_DWORD FPDFAPI_FlateOrLZWDecode(bool bLZW, const uint8_t* src_buf, FX_DWORD sr
c_size, CPDF_Dictionary* pParams, |
283 FX_DWORD estimated_size, uint8_t*& dest_buf, F
X_DWORD& dest_size); | 283 FX_DWORD estimated_size, uint8_t*& dest_buf, F
X_DWORD& dest_size); |
284 FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit, | 284 FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf, FX_DWORD limit, |
285 int width, int height, CFX_ByteString& decoder, | 285 int width, int height, CFX_ByteString& decoder, |
286 CPDF_Dictionary* pParam, uint8_t*& dest_buf, FX_
DWORD& dest_size) | 286 CPDF_Dictionary* pParam, uint8_t*& dest_buf, FX_
DWORD& dest_size) |
287 { | 287 { |
288 if (decoder == FX_BSTRC("CCITTFaxDecode") || decoder == FX_BSTRC("CCF")) { | 288 if (decoder == FX_BSTRC("CCITTFaxDecode") || decoder == FX_BSTRC("CCF")) { |
289 ICodec_ScanlineDecoder* pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, lim
it, width, height, pParam); | 289 ICodec_ScanlineDecoder* pDecoder = FPDFAPI_CreateFaxDecoder(src_buf, lim
it, width, height, pParam); |
290 return _DecodeAllScanlines(pDecoder, dest_buf, dest_size); | 290 return _DecodeAllScanlines(pDecoder, dest_buf, dest_size); |
291 } else if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85"
)) { | 291 } else if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85"
)) { |
292 return _A85Decode(src_buf, limit, dest_buf, dest_size); | 292 return _A85Decode(src_buf, limit, dest_buf, dest_size); |
293 } else if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx
")) { | 293 } else if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx
")) { |
294 return _HexDecode(src_buf, limit, dest_buf, dest_size); | 294 return _HexDecode(src_buf, limit, dest_buf, dest_size); |
295 } else if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl"))
{ | 295 } else if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl"))
{ |
296 return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size
, dest_buf, dest_size); | 296 return FPDFAPI_FlateOrLZWDecode(false, src_buf, limit, pParam, dest_size
, dest_buf, dest_size); |
297 } else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) { | 297 } else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) { |
298 return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_bu
f, dest_size); | 298 return FPDFAPI_FlateOrLZWDecode(true, src_buf, limit, pParam, 0, dest_bu
f, dest_size); |
299 } else if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) { | 299 } else if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) { |
300 ICodec_ScanlineDecoder* pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule(
)->CreateDecoder( | 300 ICodec_ScanlineDecoder* pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule(
)->CreateDecoder( |
301 src_buf, limit, width, height, 0,
pParam ? pParam->GetInteger(FX_BSTRC("ColorTransform"), 1) : 1); | 301 src_buf, limit, width, height, 0,
pParam ? pParam->GetInteger(FX_BSTRC("ColorTransform"), 1) : 1); |
302 return _DecodeAllScanlines(pDecoder, dest_buf, dest_size); | 302 return _DecodeAllScanlines(pDecoder, dest_buf, dest_size); |
303 } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL
")) { | 303 } else if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL
")) { |
304 return RunLengthDecode(src_buf, limit, dest_buf, dest_size); | 304 return RunLengthDecode(src_buf, limit, dest_buf, dest_size); |
305 } | 305 } |
306 dest_size = 0; | 306 dest_size = 0; |
307 dest_buf = 0; | 307 dest_buf = 0; |
308 return (FX_DWORD) - 1; | 308 return (FX_DWORD) - 1; |
309 } | 309 } |
310 CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti
onary* pDict, CPDF_Object* pCSObj, FX_BOOL bDecode) | 310 CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, CPDF_Dicti
onary* pDict, CPDF_Object* pCSObj, bool bDecode) |
311 { | 311 { |
312 if (m_Pos == m_Size) { | 312 if (m_Pos == m_Size) { |
313 return NULL; | 313 return NULL; |
314 } | 314 } |
315 if (PDF_CharType[m_pBuf[m_Pos]] == 'W') { | 315 if (PDF_CharType[m_pBuf[m_Pos]] == 'W') { |
316 m_Pos ++; | 316 m_Pos ++; |
317 } | 317 } |
318 CFX_ByteString Decoder; | 318 CFX_ByteString Decoder; |
319 CPDF_Dictionary* pParam = NULL; | 319 CPDF_Dictionary* pParam = NULL; |
320 CPDF_Object* pFilter = pDict->GetElementValue(FX_BSTRC("Filter")); | 320 CPDF_Object* pFilter = pDict->GetElementValue(FX_BSTRC("Filter")); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 #define FXDWORD_TRUE FXDWORD_FROM_LSBFIRST(0x65757274) | 434 #define FXDWORD_TRUE FXDWORD_FROM_LSBFIRST(0x65757274) |
435 #define FXDWORD_NULL FXDWORD_FROM_LSBFIRST(0x6c6c756e) | 435 #define FXDWORD_NULL FXDWORD_FROM_LSBFIRST(0x6c6c756e) |
436 #define FXDWORD_FALS FXDWORD_FROM_LSBFIRST(0x736c6166) | 436 #define FXDWORD_FALS FXDWORD_FROM_LSBFIRST(0x736c6166) |
437 CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() | 437 CPDF_StreamParser::SyntaxType CPDF_StreamParser::ParseNextElement() |
438 { | 438 { |
439 if (m_pLastObj) { | 439 if (m_pLastObj) { |
440 m_pLastObj->Release(); | 440 m_pLastObj->Release(); |
441 m_pLastObj = NULL; | 441 m_pLastObj = NULL; |
442 } | 442 } |
443 m_WordSize = 0; | 443 m_WordSize = 0; |
444 FX_BOOL bIsNumber = TRUE; | 444 bool bIsNumber = true; |
445 if (m_Pos >= m_Size) { | 445 if (m_Pos >= m_Size) { |
446 return EndOfData; | 446 return EndOfData; |
447 } | 447 } |
448 int ch = m_pBuf[m_Pos++]; | 448 int ch = m_pBuf[m_Pos++]; |
449 int type = PDF_CharType[ch]; | 449 int type = PDF_CharType[ch]; |
450 while (1) { | 450 while (1) { |
451 while (type == 'W') { | 451 while (type == 'W') { |
452 if (m_Size <= m_Pos) { | 452 if (m_Size <= m_Pos) { |
453 return EndOfData; | 453 return EndOfData; |
454 } | 454 } |
(...skipping 17 matching lines...) Expand all Loading... |
472 if (type == 'D' && ch != '/') { | 472 if (type == 'D' && ch != '/') { |
473 m_Pos --; | 473 m_Pos --; |
474 m_pLastObj = ReadNextObject(); | 474 m_pLastObj = ReadNextObject(); |
475 return Others; | 475 return Others; |
476 } | 476 } |
477 while (1) { | 477 while (1) { |
478 if (m_WordSize < MAX_WORD_BUFFER) { | 478 if (m_WordSize < MAX_WORD_BUFFER) { |
479 m_WordBuffer[m_WordSize++] = ch; | 479 m_WordBuffer[m_WordSize++] = ch; |
480 } | 480 } |
481 if (type != 'N') { | 481 if (type != 'N') { |
482 bIsNumber = FALSE; | 482 bIsNumber = false; |
483 } | 483 } |
484 if (m_Size <= m_Pos) { | 484 if (m_Size <= m_Pos) { |
485 break; | 485 break; |
486 } | 486 } |
487 ch = m_pBuf[m_Pos++]; | 487 ch = m_pBuf[m_Pos++]; |
488 type = PDF_CharType[ch]; | 488 type = PDF_CharType[ch]; |
489 if (type == 'D' || type == 'W') { | 489 if (type == 'D' || type == 'W') { |
490 m_Pos --; | 490 m_Pos --; |
491 break; | 491 break; |
492 } | 492 } |
493 } | 493 } |
494 m_WordBuffer[m_WordSize] = 0; | 494 m_WordBuffer[m_WordSize] = 0; |
495 if (bIsNumber) { | 495 if (bIsNumber) { |
496 return Number; | 496 return Number; |
497 } | 497 } |
498 if (m_WordBuffer[0] == '/') { | 498 if (m_WordBuffer[0] == '/') { |
499 return Name; | 499 return Name; |
500 } | 500 } |
501 if (m_WordSize == 4) { | 501 if (m_WordSize == 4) { |
502 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) { | 502 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) { |
503 m_pLastObj = CPDF_Boolean::Create(TRUE); | 503 m_pLastObj = CPDF_Boolean::Create(true); |
504 return Others; | 504 return Others; |
505 } | 505 } |
506 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) { | 506 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) { |
507 m_pLastObj = CPDF_Null::Create(); | 507 m_pLastObj = CPDF_Null::Create(); |
508 return Others; | 508 return Others; |
509 } | 509 } |
510 } else if (m_WordSize == 5) { | 510 } else if (m_WordSize == 5) { |
511 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e')
{ | 511 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e')
{ |
512 m_pLastObj = CPDF_Boolean::Create(FALSE); | 512 m_pLastObj = CPDF_Boolean::Create(false); |
513 return Others; | 513 return Others; |
514 } | 514 } |
515 } | 515 } |
516 return Keyword; | 516 return Keyword; |
517 } | 517 } |
518 void CPDF_StreamParser::SkipPathObject() | 518 void CPDF_StreamParser::SkipPathObject() |
519 { | 519 { |
520 FX_DWORD command_startpos = m_Pos; | 520 FX_DWORD command_startpos = m_Pos; |
521 if (m_Pos >= m_Size) { | 521 if (m_Pos >= m_Size) { |
522 return; | 522 return; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 if (m_pBuf[op_startpos] == 'r' && m_pBuf[op_startpos + 1] == 'e'
) { | 571 if (m_pBuf[op_startpos] == 'r' && m_pBuf[op_startpos + 1] == 'e'
) { |
572 command_startpos = m_Pos; | 572 command_startpos = m_Pos; |
573 break; | 573 break; |
574 } | 574 } |
575 } | 575 } |
576 m_Pos = command_startpos; | 576 m_Pos = command_startpos; |
577 return; | 577 return; |
578 } | 578 } |
579 } | 579 } |
580 } | 580 } |
581 CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray, FX_BOO
L bInArray) | 581 CPDF_Object* CPDF_StreamParser::ReadNextObject(bool bAllowNestedArray, bool bInA
rray) |
582 { | 582 { |
583 FX_BOOL bIsNumber; | 583 bool bIsNumber; |
584 GetNextWord(bIsNumber); | 584 GetNextWord(bIsNumber); |
585 if (m_WordSize == 0) { | 585 if (m_WordSize == 0) { |
586 return NULL; | 586 return NULL; |
587 } | 587 } |
588 if (bIsNumber) { | 588 if (bIsNumber) { |
589 m_WordBuffer[m_WordSize] = 0; | 589 m_WordBuffer[m_WordSize] = 0; |
590 return CPDF_Number::Create(CFX_ByteStringC(m_WordBuffer, m_WordSize)); | 590 return CPDF_Number::Create(CFX_ByteStringC(m_WordBuffer, m_WordSize)); |
591 } | 591 } |
592 int first_char = m_WordBuffer[0]; | 592 int first_char = m_WordBuffer[0]; |
593 if (first_char == '/') { | 593 if (first_char == '/') { |
594 return CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1
, m_WordSize - 1))); | 594 return CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1
, m_WordSize - 1))); |
595 } | 595 } |
596 if (first_char == '(') { | 596 if (first_char == '(') { |
597 return CPDF_String::Create(ReadString()); | 597 return CPDF_String::Create(ReadString()); |
598 } | 598 } |
599 if (first_char == '<') { | 599 if (first_char == '<') { |
600 if (m_WordSize == 1) { | 600 if (m_WordSize == 1) { |
601 return CPDF_String::Create(ReadHexString(), TRUE); | 601 return CPDF_String::Create(ReadHexString(), true); |
602 } | 602 } |
603 CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); | 603 CPDF_Dictionary* pDict = CPDF_Dictionary::Create(); |
604 while (1) { | 604 while (1) { |
605 GetNextWord(bIsNumber); | 605 GetNextWord(bIsNumber); |
606 if (m_WordSize == 0) { | 606 if (m_WordSize == 0) { |
607 pDict->Release(); | 607 pDict->Release(); |
608 return NULL; | 608 return NULL; |
609 } | 609 } |
610 if (m_WordSize == 2 && m_WordBuffer[0] == '>') { | 610 if (m_WordSize == 2 && m_WordBuffer[0] == '>') { |
611 break; | 611 break; |
612 } | 612 } |
613 if (m_WordBuffer[0] != '/') { | 613 if (m_WordBuffer[0] != '/') { |
614 pDict->Release(); | 614 pDict->Release(); |
615 return NULL; | 615 return NULL; |
616 } | 616 } |
617 CFX_ByteString key = PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1
, m_WordSize - 1)); | 617 CFX_ByteString key = PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1
, m_WordSize - 1)); |
618 CPDF_Object* pObj = ReadNextObject(TRUE); | 618 CPDF_Object* pObj = ReadNextObject(true); |
619 if (pObj == NULL) { | 619 if (pObj == NULL) { |
620 if (pDict) { | 620 if (pDict) { |
621 pDict->Release(); | 621 pDict->Release(); |
622 } | 622 } |
623 return NULL; | 623 return NULL; |
624 } | 624 } |
625 if (!key.IsEmpty()) { | 625 if (!key.IsEmpty()) { |
626 pDict->SetAt(key, pObj); | 626 pDict->SetAt(key, pObj); |
627 } else { | 627 } else { |
628 pObj->Release(); | 628 pObj->Release(); |
629 } | 629 } |
630 } | 630 } |
631 return pDict; | 631 return pDict; |
632 } | 632 } |
633 if (first_char == '[') { | 633 if (first_char == '[') { |
634 if (!bAllowNestedArray && bInArray) { | 634 if (!bAllowNestedArray && bInArray) { |
635 return NULL; | 635 return NULL; |
636 } | 636 } |
637 CPDF_Array* pArray = CPDF_Array::Create(); | 637 CPDF_Array* pArray = CPDF_Array::Create(); |
638 while (1) { | 638 while (1) { |
639 CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, TRUE); | 639 CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, true); |
640 if (pObj == NULL) { | 640 if (pObj == NULL) { |
641 if (m_WordSize == 0 || m_WordBuffer[0] == ']') { | 641 if (m_WordSize == 0 || m_WordBuffer[0] == ']') { |
642 return pArray; | 642 return pArray; |
643 } | 643 } |
644 if (m_WordBuffer[0] == '[') { | 644 if (m_WordBuffer[0] == '[') { |
645 continue; | 645 continue; |
646 } | 646 } |
647 } else { | 647 } else { |
648 pArray->Add(pObj); | 648 pArray->Add(pObj); |
649 } | 649 } |
650 } | 650 } |
651 } | 651 } |
652 if (m_WordSize == 4) { | 652 if (m_WordSize == 4) { |
653 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) { | 653 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_TRUE) { |
654 return CPDF_Boolean::Create(TRUE); | 654 return CPDF_Boolean::Create(true); |
655 } | 655 } |
656 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) { | 656 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_NULL) { |
657 return CPDF_Null::Create(); | 657 return CPDF_Null::Create(); |
658 } | 658 } |
659 } else if (m_WordSize == 5) { | 659 } else if (m_WordSize == 5) { |
660 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e')
{ | 660 if (*(FX_DWORD*)m_WordBuffer == FXDWORD_FALS && m_WordBuffer[4] == 'e')
{ |
661 return CPDF_Boolean::Create(FALSE); | 661 return CPDF_Boolean::Create(false); |
662 } | 662 } |
663 } | 663 } |
664 return NULL; | 664 return NULL; |
665 } | 665 } |
666 void CPDF_StreamParser::GetNextWord(FX_BOOL& bIsNumber) | 666 void CPDF_StreamParser::GetNextWord(bool& bIsNumber) |
667 { | 667 { |
668 m_WordSize = 0; | 668 m_WordSize = 0; |
669 bIsNumber = TRUE; | 669 bIsNumber = true; |
670 if (m_Size <= m_Pos) { | 670 if (m_Size <= m_Pos) { |
671 return; | 671 return; |
672 } | 672 } |
673 int ch = m_pBuf[m_Pos++]; | 673 int ch = m_pBuf[m_Pos++]; |
674 int type = PDF_CharType[ch]; | 674 int type = PDF_CharType[ch]; |
675 while (1) { | 675 while (1) { |
676 while (type == 'W') { | 676 while (type == 'W') { |
677 if (m_Size <= m_Pos) { | 677 if (m_Size <= m_Pos) { |
678 return; | 678 return; |
679 } | 679 } |
680 ch = m_pBuf[m_Pos++]; | 680 ch = m_pBuf[m_Pos++]; |
681 type = PDF_CharType[ch]; | 681 type = PDF_CharType[ch]; |
682 } | 682 } |
683 if (ch != '%') { | 683 if (ch != '%') { |
684 break; | 684 break; |
685 } | 685 } |
686 while (1) { | 686 while (1) { |
687 if (m_Size <= m_Pos) { | 687 if (m_Size <= m_Pos) { |
688 return; | 688 return; |
689 } | 689 } |
690 ch = m_pBuf[m_Pos++]; | 690 ch = m_pBuf[m_Pos++]; |
691 if (ch == '\r' || ch == '\n') { | 691 if (ch == '\r' || ch == '\n') { |
692 break; | 692 break; |
693 } | 693 } |
694 } | 694 } |
695 type = PDF_CharType[ch]; | 695 type = PDF_CharType[ch]; |
696 } | 696 } |
697 if (type == 'D') { | 697 if (type == 'D') { |
698 bIsNumber = FALSE; | 698 bIsNumber = false; |
699 m_WordBuffer[m_WordSize++] = ch; | 699 m_WordBuffer[m_WordSize++] = ch; |
700 if (ch == '/') { | 700 if (ch == '/') { |
701 while (1) { | 701 while (1) { |
702 if (m_Size <= m_Pos) { | 702 if (m_Size <= m_Pos) { |
703 return; | 703 return; |
704 } | 704 } |
705 ch = m_pBuf[m_Pos++]; | 705 ch = m_pBuf[m_Pos++]; |
706 type = PDF_CharType[ch]; | 706 type = PDF_CharType[ch]; |
707 if (type != 'R' && type != 'N') { | 707 if (type != 'R' && type != 'N') { |
708 m_Pos --; | 708 m_Pos --; |
(...skipping 24 matching lines...) Expand all Loading... |
733 m_Pos --; | 733 m_Pos --; |
734 } | 734 } |
735 } | 735 } |
736 return; | 736 return; |
737 } | 737 } |
738 while (1) { | 738 while (1) { |
739 if (m_WordSize < MAX_WORD_BUFFER) { | 739 if (m_WordSize < MAX_WORD_BUFFER) { |
740 m_WordBuffer[m_WordSize++] = ch; | 740 m_WordBuffer[m_WordSize++] = ch; |
741 } | 741 } |
742 if (type != 'N') { | 742 if (type != 'N') { |
743 bIsNumber = FALSE; | 743 bIsNumber = false; |
744 } | 744 } |
745 if (m_Size <= m_Pos) { | 745 if (m_Size <= m_Pos) { |
746 return; | 746 return; |
747 } | 747 } |
748 ch = m_pBuf[m_Pos++]; | 748 ch = m_pBuf[m_Pos++]; |
749 type = PDF_CharType[ch]; | 749 type = PDF_CharType[ch]; |
750 if (type == 'D' || type == 'W') { | 750 if (type == 'D' || type == 'W') { |
751 m_Pos --; | 751 m_Pos --; |
752 break; | 752 break; |
753 } | 753 } |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 } | 849 } |
850 return buf.GetByteString(); | 850 return buf.GetByteString(); |
851 } | 851 } |
852 CFX_ByteString CPDF_StreamParser::ReadHexString() | 852 CFX_ByteString CPDF_StreamParser::ReadHexString() |
853 { | 853 { |
854 if (m_Size <= m_Pos) { | 854 if (m_Size <= m_Pos) { |
855 return CFX_ByteString(); | 855 return CFX_ByteString(); |
856 } | 856 } |
857 int ch = m_pBuf[m_Pos++]; | 857 int ch = m_pBuf[m_Pos++]; |
858 CFX_ByteTextBuf buf; | 858 CFX_ByteTextBuf buf; |
859 FX_BOOL bFirst = TRUE; | 859 bool bFirst = true; |
860 int code = 0; | 860 int code = 0; |
861 while (1) { | 861 while (1) { |
862 if (ch == '>') { | 862 if (ch == '>') { |
863 break; | 863 break; |
864 } | 864 } |
865 if (ch >= '0' && ch <= '9') { | 865 if (ch >= '0' && ch <= '9') { |
866 if (bFirst) { | 866 if (bFirst) { |
867 code = (ch - '0') * 16; | 867 code = (ch - '0') * 16; |
868 } else { | 868 } else { |
869 code += ch - '0'; | 869 code += ch - '0'; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 m_pData = NULL; | 934 m_pData = NULL; |
935 m_Status = Ready; | 935 m_Status = Ready; |
936 } | 936 } |
937 void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) | 937 void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) |
938 { | 938 { |
939 if (m_Status != Ready || pPage == NULL || pPage->m_pDocument == NULL || pPag
e->m_pFormDict == NULL) { | 939 if (m_Status != Ready || pPage == NULL || pPage->m_pDocument == NULL || pPag
e->m_pFormDict == NULL) { |
940 m_Status = Done; | 940 m_Status = Done; |
941 return; | 941 return; |
942 } | 942 } |
943 m_pObjects = pPage; | 943 m_pObjects = pPage; |
944 m_bForm = FALSE; | 944 m_bForm = false; |
945 if (pOptions) { | 945 if (pOptions) { |
946 m_Options = *pOptions; | 946 m_Options = *pOptions; |
947 } | 947 } |
948 m_Status = ToBeContinued; | 948 m_Status = ToBeContinued; |
949 m_InternalStage = PAGEPARSE_STAGE_GETCONTENT; | 949 m_InternalStage = PAGEPARSE_STAGE_GETCONTENT; |
950 m_CurrentOffset = 0; | 950 m_CurrentOffset = 0; |
951 CPDF_Object* pContent = pPage->m_pFormDict->GetElementValue(FX_BSTRC("Conten
ts")); | 951 CPDF_Object* pContent = pPage->m_pFormDict->GetElementValue(FX_BSTRC("Conten
ts")); |
952 if (pContent == NULL) { | 952 if (pContent == NULL) { |
953 m_Status = Done; | 953 m_Status = Done; |
954 return; | 954 return; |
955 } | 955 } |
956 if (pContent->GetType() == PDFOBJ_STREAM) { | 956 if (pContent->GetType() == PDFOBJ_STREAM) { |
957 m_nStreams = 0; | 957 m_nStreams = 0; |
958 m_pSingleStream = new CPDF_StreamAcc; | 958 m_pSingleStream = new CPDF_StreamAcc; |
959 m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, FALSE); | 959 m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, false); |
960 } else if (pContent->GetType() == PDFOBJ_ARRAY) { | 960 } else if (pContent->GetType() == PDFOBJ_ARRAY) { |
961 CPDF_Array* pArray = (CPDF_Array*)pContent; | 961 CPDF_Array* pArray = (CPDF_Array*)pContent; |
962 m_nStreams = pArray->GetCount(); | 962 m_nStreams = pArray->GetCount(); |
963 if (m_nStreams == 0) { | 963 if (m_nStreams == 0) { |
964 m_Status = Done; | 964 m_Status = Done; |
965 return; | 965 return; |
966 } | 966 } |
967 m_pStreamArray = FX_Alloc(CPDF_StreamAcc*, m_nStreams); | 967 m_pStreamArray = FX_Alloc(CPDF_StreamAcc*, m_nStreams); |
968 } else { | 968 } else { |
969 m_Status = Done; | 969 m_Status = Done; |
970 return; | 970 return; |
971 } | 971 } |
972 } | 972 } |
973 void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, | 973 void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, |
974 CFX_AffineMatrix* pParentMatrix, CPDF_Type3Char*
pType3Char, CPDF_ParseOptions* pOptions, int level) | 974 CFX_AffineMatrix* pParentMatrix, CPDF_Type3Char*
pType3Char, CPDF_ParseOptions* pOptions, int level) |
975 { | 975 { |
976 m_pType3Char = pType3Char; | 976 m_pType3Char = pType3Char; |
977 m_pObjects = pForm; | 977 m_pObjects = pForm; |
978 m_bForm = TRUE; | 978 m_bForm = true; |
979 CFX_AffineMatrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matri
x")); | 979 CFX_AffineMatrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matri
x")); |
980 if (pGraphicStates) { | 980 if (pGraphicStates) { |
981 form_matrix.Concat(pGraphicStates->m_CTM); | 981 form_matrix.Concat(pGraphicStates->m_CTM); |
982 } | 982 } |
983 CPDF_Array* pBBox = pForm->m_pFormDict->GetArray(FX_BSTRC("BBox")); | 983 CPDF_Array* pBBox = pForm->m_pFormDict->GetArray(FX_BSTRC("BBox")); |
984 CFX_FloatRect form_bbox; | 984 CFX_FloatRect form_bbox; |
985 CPDF_Path ClipPath; | 985 CPDF_Path ClipPath; |
986 if (pBBox) { | 986 if (pBBox) { |
987 form_bbox = pBBox->GetRect(); | 987 form_bbox = pBBox->GetRect(); |
988 ClipPath.New(); | 988 ClipPath.New(); |
989 ClipPath.AppendRect(form_bbox.left, form_bbox.bottom, form_bbox.right, f
orm_bbox.top); | 989 ClipPath.AppendRect(form_bbox.left, form_bbox.bottom, form_bbox.right, f
orm_bbox.top); |
990 ClipPath.Transform(&form_matrix); | 990 ClipPath.Transform(&form_matrix); |
991 if (pParentMatrix) { | 991 if (pParentMatrix) { |
992 ClipPath.Transform(pParentMatrix); | 992 ClipPath.Transform(pParentMatrix); |
993 } | 993 } |
994 form_bbox.Transform(&form_matrix); | 994 form_bbox.Transform(&form_matrix); |
995 if (pParentMatrix) { | 995 if (pParentMatrix) { |
996 form_bbox.Transform(pParentMatrix); | 996 form_bbox.Transform(pParentMatrix); |
997 } | 997 } |
998 } | 998 } |
999 CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDict(FX_BSTRC("Resource
s")); | 999 CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDict(FX_BSTRC("Resource
s")); |
1000 m_pParser = new CPDF_StreamContentParser( | 1000 m_pParser = new CPDF_StreamContentParser( |
1001 pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, | 1001 pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, |
1002 pParentMatrix, pForm, pResources, &form_bbox, pOptions, pGraphicStates, | 1002 pParentMatrix, pForm, pResources, &form_bbox, pOptions, pGraphicStates, |
1003 level); | 1003 level); |
1004 | 1004 |
1005 m_pParser->GetCurStates()->m_CTM = form_matrix; | 1005 m_pParser->GetCurStates()->m_CTM = form_matrix; |
1006 m_pParser->GetCurStates()->m_ParentMatrix = form_matrix; | 1006 m_pParser->GetCurStates()->m_ParentMatrix = form_matrix; |
1007 if (ClipPath.NotNull()) { | 1007 if (ClipPath.NotNull()) { |
1008 m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDIN
G, TRUE); | 1008 m_pParser->GetCurStates()->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDIN
G, true); |
1009 } | 1009 } |
1010 if (pForm->m_Transparency & PDFTRANS_GROUP) { | 1010 if (pForm->m_Transparency & PDFTRANS_GROUP) { |
1011 CPDF_GeneralStateData* pData = m_pParser->GetCurStates()->m_GeneralState
.GetModify(); | 1011 CPDF_GeneralStateData* pData = m_pParser->GetCurStates()->m_GeneralState
.GetModify(); |
1012 pData->m_BlendType = FXDIB_BLEND_NORMAL; | 1012 pData->m_BlendType = FXDIB_BLEND_NORMAL; |
1013 pData->m_StrokeAlpha = 1.0f; | 1013 pData->m_StrokeAlpha = 1.0f; |
1014 pData->m_FillAlpha = 1.0f; | 1014 pData->m_FillAlpha = 1.0f; |
1015 pData->m_pSoftMask = NULL; | 1015 pData->m_pSoftMask = NULL; |
1016 } | 1016 } |
1017 m_nStreams = 0; | 1017 m_nStreams = 0; |
1018 m_pSingleStream = new CPDF_StreamAcc; | 1018 m_pSingleStream = new CPDF_StreamAcc; |
1019 if (pForm->m_pDocument) { | 1019 if (pForm->m_pDocument) { |
1020 m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); | 1020 m_pSingleStream->LoadAllData(pForm->m_pFormStream, false); |
1021 } else { | 1021 } else { |
1022 m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); | 1022 m_pSingleStream->LoadAllData(pForm->m_pFormStream, false); |
1023 } | 1023 } |
1024 m_pData = (uint8_t*)m_pSingleStream->GetData(); | 1024 m_pData = (uint8_t*)m_pSingleStream->GetData(); |
1025 m_Size = m_pSingleStream->GetSize(); | 1025 m_Size = m_pSingleStream->GetSize(); |
1026 m_Status = ToBeContinued; | 1026 m_Status = ToBeContinued; |
1027 m_InternalStage = PAGEPARSE_STAGE_PARSE; | 1027 m_InternalStage = PAGEPARSE_STAGE_PARSE; |
1028 m_CurrentOffset = 0; | 1028 m_CurrentOffset = 0; |
1029 } | 1029 } |
1030 void CPDF_ContentParser::Continue(IFX_Pause* pPause) | 1030 void CPDF_ContentParser::Continue(IFX_Pause* pPause) |
1031 { | 1031 { |
1032 int steps = 0; | 1032 int steps = 0; |
(...skipping 24 matching lines...) Expand all Loading... |
1057 } else { | 1057 } else { |
1058 m_pData = (uint8_t*)m_pSingleStream->GetData(); | 1058 m_pData = (uint8_t*)m_pSingleStream->GetData(); |
1059 m_Size = m_pSingleStream->GetSize(); | 1059 m_Size = m_pSingleStream->GetSize(); |
1060 } | 1060 } |
1061 m_InternalStage = PAGEPARSE_STAGE_PARSE; | 1061 m_InternalStage = PAGEPARSE_STAGE_PARSE; |
1062 m_CurrentOffset = 0; | 1062 m_CurrentOffset = 0; |
1063 } else { | 1063 } else { |
1064 CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTR
C("Contents")); | 1064 CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTR
C("Contents")); |
1065 m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc; | 1065 m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc; |
1066 CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->Ge
tElementValue(m_CurrentOffset) : NULL); | 1066 CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->Ge
tElementValue(m_CurrentOffset) : NULL); |
1067 m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); | 1067 m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, false); |
1068 m_CurrentOffset ++; | 1068 m_CurrentOffset ++; |
1069 } | 1069 } |
1070 } | 1070 } |
1071 if (m_InternalStage == PAGEPARSE_STAGE_PARSE) { | 1071 if (m_InternalStage == PAGEPARSE_STAGE_PARSE) { |
1072 if (!m_pParser) { | 1072 if (!m_pParser) { |
1073 m_pParser = new CPDF_StreamContentParser( | 1073 m_pParser = new CPDF_StreamContentParser( |
1074 m_pObjects->m_pDocument, m_pObjects->m_pPageResources, | 1074 m_pObjects->m_pDocument, m_pObjects->m_pPageResources, |
1075 nullptr, nullptr, m_pObjects, m_pObjects->m_pResources, | 1075 nullptr, nullptr, m_pObjects, m_pObjects->m_pResources, |
1076 &m_pObjects->m_BBox, &m_Options, nullptr, 0); | 1076 &m_pObjects->m_BBox, &m_Options, nullptr, 0); |
1077 m_pParser->GetCurStates()->m_ColorState.GetModify()->Default(); | 1077 m_pParser->GetCurStates()->m_ColorState.GetModify()->Default(); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1136 return 100; | 1136 return 100; |
1137 } | 1137 } |
1138 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) { | 1138 if (m_InternalStage == PAGEPARSE_STAGE_GETCONTENT) { |
1139 return 10; | 1139 return 10; |
1140 } | 1140 } |
1141 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { | 1141 if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { |
1142 return 90; | 1142 return 90; |
1143 } | 1143 } |
1144 return 10 + 80 * m_CurrentOffset / m_Size; | 1144 return 10 + 80 * m_CurrentOffset / m_Size; |
1145 } | 1145 } |
OLD | NEW |