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 "../../fx_zlib.h" | 7 #include "../../fx_zlib.h" |
8 #include "../../../include/fpdfapi/fpdf_parser.h" | 8 #include "../../../include/fpdfapi/fpdf_parser.h" |
9 #include "../../../include/fxcodec/fx_codec.h" | 9 #include "../../../include/fxcodec/fx_codec.h" |
10 #include "../../../include/fpdfapi/fpdf_module.h" | 10 #include "../../../include/fpdfapi/fpdf_module.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, i
nt width, int height) | 69 CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, i
nt width, int height) |
70 { | 70 { |
71 FX_DWORD id = name.GetID(); | 71 FX_DWORD id = name.GetID(); |
72 switch (id) { | 72 switch (id) { |
73 case FXBSTR_ID('F', 'l', 'a', 't'): | 73 case FXBSTR_ID('F', 'l', 'a', 't'): |
74 case FXBSTR_ID('F', 'l', 0, 0): | 74 case FXBSTR_ID('F', 'l', 0, 0): |
75 case FXBSTR_ID('L', 'Z', 'W', 'D'): | 75 case FXBSTR_ID('L', 'Z', 'W', 'D'): |
76 case FXBSTR_ID('L', 'Z', 'W', 0): { | 76 case FXBSTR_ID('L', 'Z', 'W', 0): { |
77 CFX_DataFilter* pFilter; | 77 CFX_DataFilter* pFilter; |
78 if (id == FXBSTR_ID('L', 'Z', 'W', 'D') || id == FXBSTR_ID('L',
'Z', 'W', 0)) { | 78 if (id == FXBSTR_ID('L', 'Z', 'W', 'D') || id == FXBSTR_ID('L',
'Z', 'W', 0)) { |
79 pFilter = FX_NEW CPDF_LzwFilter(pParam->GetInteger("EarlyCha
nge", 1)); | 79 pFilter = FX_NEW CPDF_LzwFilter(pParam ? pParam->GetInteger(
"EarlyChange", 1) : 1); |
80 } else { | 80 } else { |
81 pFilter = FX_NEW CPDF_FlateFilter; | 81 pFilter = FX_NEW CPDF_FlateFilter; |
82 } | 82 } |
83 if (pParam->GetInteger("Predictor", 1) > 1) { | 83 if ((pParam ? pParam->GetInteger("Predictor", 1) : 1) > 1) { |
84 CFX_DataFilter* pPredictor = FX_NEW CPDF_PredictorFilter(pPa
ram->GetInteger(FX_BSTRC("Predictor"), 1), | 84 CFX_DataFilter* pPredictor = FX_NEW CPDF_PredictorFilter(pPa
ram->GetInteger(FX_BSTRC("Predictor"), 1), |
85 pParam->GetInteger(FX_BSTRC("Co
lors"), 1), pParam->GetInteger(FX_BSTRC("BitsPerComponent"), 8), | 85 pParam->GetInteger(FX_BSTRC("Co
lors"), 1), pParam->GetInteger(FX_BSTRC("BitsPerComponent"), 8), |
86 pParam->GetInteger(FX_BSTRC("Co
lumns"), 1)); | 86 pParam->GetInteger(FX_BSTRC("Co
lumns"), 1)); |
87 pFilter->SetDestFilter(pPredictor); | 87 pFilter->SetDestFilter(pPredictor); |
88 } | 88 } |
89 return pFilter; | 89 return pFilter; |
90 } | 90 } |
91 case FXBSTR_ID('A', 'S', 'C', 'I'): | 91 case FXBSTR_ID('A', 'S', 'C', 'I'): |
92 if (name == "ASCIIHexDecode") { | 92 if (name == "ASCIIHexDecode") { |
93 return FX_NEW CPDF_AsciiHexFilter; | 93 return FX_NEW CPDF_AsciiHexFilter; |
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 } | 900 } |
901 if (m_bEndOfLine) | 901 if (m_bEndOfLine) |
902 if (!_FaxSkipEOL(src_buf, bitsize, bitpos)) { | 902 if (!_FaxSkipEOL(src_buf, bitsize, bitpos)) { |
903 return FALSE; | 903 return FALSE; |
904 } | 904 } |
905 if (m_bByteAlign) { | 905 if (m_bByteAlign) { |
906 bitpos = (bitpos + 7) / 8 * 8; | 906 bitpos = (bitpos + 7) / 8 * 8; |
907 } | 907 } |
908 return TRUE; | 908 return TRUE; |
909 } | 909 } |
OLD | NEW |