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/fpdf_parser/include/fpdf_parser_decode.h" | 7 #include "core/fpdfapi/fpdf_parser/include/fpdf_parser_decode.h" |
8 | 8 |
9 #include <limits.h> | 9 #include <limits.h> |
10 #include <vector> | 10 #include <vector> |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 | 329 |
330 FX_BOOL PDF_DataDecode(const uint8_t* src_buf, | 330 FX_BOOL PDF_DataDecode(const uint8_t* src_buf, |
331 uint32_t src_size, | 331 uint32_t src_size, |
332 const CPDF_Dictionary* pDict, | 332 const CPDF_Dictionary* pDict, |
333 uint8_t*& dest_buf, | 333 uint8_t*& dest_buf, |
334 uint32_t& dest_size, | 334 uint32_t& dest_size, |
335 CFX_ByteString& ImageEncoding, | 335 CFX_ByteString& ImageEncoding, |
336 CPDF_Dictionary*& pImageParms, | 336 CPDF_Dictionary*& pImageParms, |
337 uint32_t last_estimated_size, | 337 uint32_t last_estimated_size, |
338 FX_BOOL bImageAcc) { | 338 FX_BOOL bImageAcc) { |
339 CPDF_Object* pDecoder = pDict ? pDict->GetElementValue("Filter") : nullptr; | 339 CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectBy("Filter") : nullptr; |
340 if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName())) | 340 if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName())) |
341 return FALSE; | 341 return FALSE; |
342 | 342 |
343 CPDF_Object* pParams = | 343 CPDF_Object* pParams = |
344 pDict ? pDict->GetElementValue("DecodeParms") : nullptr; | 344 pDict ? pDict->GetDirectObjectBy("DecodeParms") : nullptr; |
345 std::vector<CFX_ByteString> DecoderList; | 345 std::vector<CFX_ByteString> DecoderList; |
346 CFX_ArrayTemplate<CPDF_Object*> ParamList; | 346 CFX_ArrayTemplate<CPDF_Object*> ParamList; |
347 if (CPDF_Array* pDecoders = pDecoder->AsArray()) { | 347 if (CPDF_Array* pDecoders = pDecoder->AsArray()) { |
348 CPDF_Array* pParamsArray = ToArray(pParams); | 348 CPDF_Array* pParamsArray = ToArray(pParams); |
349 if (!pParamsArray) | 349 if (!pParamsArray) |
350 pParams = nullptr; | 350 pParams = nullptr; |
351 | 351 |
352 for (uint32_t i = 0; i < pDecoders->GetCount(); i++) { | 352 for (uint32_t i = 0; i < pDecoders->GetCount(); i++) { |
353 DecoderList.push_back(pDecoders->GetConstStringAt(i)); | 353 DecoderList.push_back(pDecoders->GetConstStringAt(i)); |
354 ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr); | 354 ParamList.Add(pParams ? pParamsArray->GetDictAt(i) : nullptr); |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
580 uint32_t src_size, | 580 uint32_t src_size, |
581 uint8_t*& dest_buf, | 581 uint8_t*& dest_buf, |
582 uint32_t& dest_size) { | 582 uint32_t& dest_size) { |
583 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); | 583 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); |
584 if (pEncoders) { | 584 if (pEncoders) { |
585 return pEncoders->GetFlateModule()->FlateOrLZWDecode( | 585 return pEncoders->GetFlateModule()->FlateOrLZWDecode( |
586 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); | 586 FALSE, src_buf, src_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); |
587 } | 587 } |
588 return 0; | 588 return 0; |
589 } | 589 } |
OLD | NEW |