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/fxcodec/include/fx_codec.h" | 7 #include "core/fxcodec/include/fx_codec.h" |
8 | 8 |
9 #include <cmath> | 9 #include <cmath> |
10 #include <memory> | 10 #include <memory> |
(...skipping 16 matching lines...) Expand all Loading... |
27 m_pGifModule(new CCodec_GifModule), | 27 m_pGifModule(new CCodec_GifModule), |
28 m_pBmpModule(new CCodec_BmpModule), | 28 m_pBmpModule(new CCodec_BmpModule), |
29 m_pTiffModule(new CCodec_TiffModule), | 29 m_pTiffModule(new CCodec_TiffModule), |
30 #endif // PDF_ENABLE_XFA | 30 #endif // PDF_ENABLE_XFA |
31 m_pFlateModule(new CCodec_FlateModule) { | 31 m_pFlateModule(new CCodec_FlateModule) { |
32 } | 32 } |
33 | 33 |
34 CCodec_ModuleMgr::~CCodec_ModuleMgr() {} | 34 CCodec_ModuleMgr::~CCodec_ModuleMgr() {} |
35 | 35 |
36 CCodec_ScanlineDecoder::CCodec_ScanlineDecoder() | 36 CCodec_ScanlineDecoder::CCodec_ScanlineDecoder() |
37 : m_NextLine(-1), m_pLastScanline(nullptr) {} | 37 : CCodec_ScanlineDecoder(0, 0, 0, 0, 0, 0, 0) {} |
| 38 |
| 39 CCodec_ScanlineDecoder::CCodec_ScanlineDecoder(int nOrigWidth, |
| 40 int nOrigHeight, |
| 41 int nOutputWidth, |
| 42 int nOutputHeight, |
| 43 int nComps, |
| 44 int nBpc, |
| 45 uint32_t nPitch) |
| 46 : m_OrigWidth(nOrigWidth), |
| 47 m_OrigHeight(nOrigHeight), |
| 48 m_OutputWidth(nOutputWidth), |
| 49 m_OutputHeight(nOutputHeight), |
| 50 m_nComps(nComps), |
| 51 m_bpc(nBpc), |
| 52 m_Pitch(nPitch), |
| 53 m_NextLine(-1), |
| 54 m_pLastScanline(nullptr) {} |
38 | 55 |
39 CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() {} | 56 CCodec_ScanlineDecoder::~CCodec_ScanlineDecoder() {} |
40 | 57 |
41 const uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) { | 58 const uint8_t* CCodec_ScanlineDecoder::GetScanline(int line) { |
42 if (m_NextLine == line + 1) | 59 if (m_NextLine == line + 1) |
43 return m_pLastScanline; | 60 return m_pLastScanline; |
44 | 61 |
45 if (m_NextLine < 0 || m_NextLine > line) { | 62 if (m_NextLine < 0 || m_NextLine > line) { |
46 if (!v_Rewind()) | 63 if (!v_Rewind()) |
47 return nullptr; | 64 return nullptr; |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 int bpc) { | 311 int bpc) { |
295 std::unique_ptr<CCodec_RLScanlineDecoder> pRLScanlineDecoder( | 312 std::unique_ptr<CCodec_RLScanlineDecoder> pRLScanlineDecoder( |
296 new CCodec_RLScanlineDecoder); | 313 new CCodec_RLScanlineDecoder); |
297 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, | 314 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, |
298 bpc)) { | 315 bpc)) { |
299 return nullptr; | 316 return nullptr; |
300 } | 317 } |
301 | 318 |
302 return pRLScanlineDecoder.release(); | 319 return pRLScanlineDecoder.release(); |
303 } | 320 } |
OLD | NEW |