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_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.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 <limits.h> | 10 #include <limits.h> |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 check *= BitsPerComponent; | 231 check *= BitsPerComponent; |
232 if (check > INT_MAX - 7) { | 232 if (check > INT_MAX - 7) { |
233 return FALSE; | 233 return FALSE; |
234 } | 234 } |
235 return TRUE; | 235 return TRUE; |
236 } | 236 } |
237 ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD
src_size, int width, int height, | 237 ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(FX_LPCBYTE src_buf, FX_DWORD
src_size, int width, int height, |
238 int nComps, int bpc, const CPDF_Dictionary* pParams) | 238 int nComps, int bpc, const CPDF_Dictionary* pParams) |
239 { | 239 { |
240 int predictor = 0; | 240 int predictor = 0; |
| 241 // TODO(tsepez): bEarlyChange not use, also BPC vs. bits per component? |
241 FX_BOOL bEarlyChange = TRUE; | 242 FX_BOOL bEarlyChange = TRUE; |
242 int Colors = 0, BitsPerComponent = 0, Columns = 0; | 243 int Colors = 0, BitsPerComponent = 0, Columns = 0; |
243 if (pParams) { | 244 if (pParams) { |
244 predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor"
)); | 245 predictor = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("Predictor"
)); |
245 bEarlyChange = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("EarlyCh
ange"), 1); | 246 bEarlyChange = ((CPDF_Dictionary*)pParams)->GetInteger(FX_BSTRC("EarlyCh
ange"), 1); |
246 Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1); | 247 Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1); |
247 BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8); | 248 BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8); |
248 Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1); | 249 Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1); |
249 if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) { | 250 if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) { |
250 return NULL; | 251 return NULL; |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 } | 532 } |
532 } | 533 } |
533 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
buf, FX_DWORD& dest_size) | 534 FX_DWORD FlateDecode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_
buf, FX_DWORD& dest_size) |
534 { | 535 { |
535 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); | 536 CCodec_ModuleMgr* pEncoders = CPDF_ModuleMgr::Get()->GetCodecModule(); |
536 if (pEncoders) { | 537 if (pEncoders) { |
537 return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src
_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); | 538 return pEncoders->GetFlateModule()->FlateOrLZWDecode(FALSE, src_buf, src
_size, FALSE, 0, 0, 0, 0, 0, dest_buf, dest_size); |
538 } | 539 } |
539 return 0; | 540 return 0; |
540 } | 541 } |
OLD | NEW |