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 "core/fpdfapi/parser/fpdf_parser_decode.h" | 7 #include "core/fpdfapi/parser/fpdf_parser_decode.h" |
8 | 8 |
9 #include <limits.h> | 9 #include <limits.h> |
10 | 10 |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 } | 298 } |
299 | 299 |
300 uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, | 300 uint32_t FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW, |
301 const uint8_t* src_buf, | 301 const uint8_t* src_buf, |
302 uint32_t src_size, | 302 uint32_t src_size, |
303 CPDF_Dictionary* pParams, | 303 CPDF_Dictionary* pParams, |
304 uint32_t estimated_size, | 304 uint32_t estimated_size, |
305 uint8_t*& dest_buf, | 305 uint8_t*& dest_buf, |
306 uint32_t& dest_size) { | 306 uint32_t& dest_size) { |
307 int predictor = 0; | 307 int predictor = 0; |
| 308 int Colors = 0; |
| 309 int BitsPerComponent = 0; |
| 310 int Columns = 0; |
308 FX_BOOL bEarlyChange = TRUE; | 311 FX_BOOL bEarlyChange = TRUE; |
309 int Colors = 0, BitsPerComponent = 0, Columns = 0; | |
310 if (pParams) { | 312 if (pParams) { |
311 predictor = pParams->GetIntegerFor("Predictor"); | 313 predictor = pParams->GetIntegerFor("Predictor"); |
312 bEarlyChange = pParams->GetIntegerFor("EarlyChange", 1); | 314 bEarlyChange = !!pParams->GetIntegerFor("EarlyChange", 1); |
313 Colors = pParams->GetIntegerFor("Colors", 1); | 315 Colors = pParams->GetIntegerFor("Colors", 1); |
314 BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8); | 316 BitsPerComponent = pParams->GetIntegerFor("BitsPerComponent", 8); |
315 Columns = pParams->GetIntegerFor("Columns", 1); | 317 Columns = pParams->GetIntegerFor("Columns", 1); |
316 if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) { | 318 if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) |
317 return (uint32_t)-1; | 319 return (uint32_t)-1; |
318 } | |
319 } | 320 } |
320 return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode( | 321 return CPDF_ModuleMgr::Get()->GetFlateModule()->FlateOrLZWDecode( |
321 bLZW, src_buf, src_size, bEarlyChange, predictor, Colors, | 322 bLZW, src_buf, src_size, bEarlyChange, predictor, Colors, |
322 BitsPerComponent, Columns, estimated_size, dest_buf, dest_size); | 323 BitsPerComponent, Columns, estimated_size, dest_buf, dest_size); |
323 } | 324 } |
324 | 325 |
325 FX_BOOL PDF_DataDecode(const uint8_t* src_buf, | 326 FX_BOOL PDF_DataDecode(const uint8_t* src_buf, |
326 uint32_t src_size, | 327 uint32_t src_size, |
327 const CPDF_Dictionary* pDict, | 328 const CPDF_Dictionary* pDict, |
328 uint8_t*& dest_buf, | 329 uint8_t*& dest_buf, |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
566 uint32_t src_size, | 567 uint32_t src_size, |
567 uint8_t*& dest_buf, | 568 uint8_t*& dest_buf, |
568 uint32_t& dest_size) { | 569 uint32_t& dest_size) { |
569 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); | 570 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); |
570 if (pEncoders) { | 571 if (pEncoders) { |
571 return pEncoders->GetFlateModule()->FlateOrLZWDecode( | 572 return pEncoders->GetFlateModule()->FlateOrLZWDecode( |
572 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); | 573 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); |
573 } | 574 } |
574 return 0; | 575 return 0; |
575 } | 576 } |
OLD | NEW |