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/fxcodec/fx_codec.h" | 7 #include "../../../include/fxcodec/fx_codec.h" |
8 #include "codec_int.h" | 8 #include "codec_int.h" |
9 CCodec_ModuleMgr::CCodec_ModuleMgr() | 9 CCodec_ModuleMgr::CCodec_ModuleMgr() |
10 { | 10 { |
11 m_pBasicModule = FX_NEW CCodec_BasicModule; | 11 m_pBasicModule = new CCodec_BasicModule; |
12 m_pFaxModule = FX_NEW CCodec_FaxModule; | 12 m_pFaxModule = new CCodec_FaxModule; |
13 m_pJpegModule = FX_NEW CCodec_JpegModule; | 13 m_pJpegModule = new CCodec_JpegModule; |
14 m_pJpxModule = FX_NEW CCodec_JpxModule; | 14 m_pJpxModule = new CCodec_JpxModule; |
15 m_pJbig2Module = FX_NEW CCodec_Jbig2Module; | 15 m_pJbig2Module = new CCodec_Jbig2Module; |
16 m_pIccModule = FX_NEW CCodec_IccModule; | 16 m_pIccModule = new CCodec_IccModule; |
17 m_pFlateModule = FX_NEW CCodec_FlateModule; | 17 m_pFlateModule = new CCodec_FlateModule; |
18 } | 18 } |
19 CCodec_ModuleMgr::~CCodec_ModuleMgr() | 19 CCodec_ModuleMgr::~CCodec_ModuleMgr() |
20 { | 20 { |
21 delete m_pBasicModule; | 21 delete m_pBasicModule; |
22 delete m_pFaxModule; | 22 delete m_pFaxModule; |
23 delete m_pJpegModule; | 23 delete m_pJpegModule; |
24 delete m_pFlateModule; | 24 delete m_pFlateModule; |
25 delete m_pJpxModule; | 25 delete m_pJpxModule; |
26 delete m_pJbig2Module; | 26 delete m_pJbig2Module; |
27 delete m_pIccModule; | 27 delete m_pIccModule; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } | 236 } |
237 return is_negative ? -ret : ret; | 237 return is_negative ? -ret : ret; |
238 } | 238 } |
239 FX_BOOL CCodec_BasicModule::A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size,
FX_LPBYTE& dest_buf, | 239 FX_BOOL CCodec_BasicModule::A85Encode(const FX_BYTE* src_buf, FX_DWORD src_size,
FX_LPBYTE& dest_buf, |
240 FX_DWORD& dest_size) | 240 FX_DWORD& dest_size) |
241 { | 241 { |
242 return FALSE; | 242 return FALSE; |
243 } | 243 } |
244 CCodec_ModuleMgr* CCodec_ModuleMgr::Create() | 244 CCodec_ModuleMgr* CCodec_ModuleMgr::Create() |
245 { | 245 { |
246 return FX_NEW CCodec_ModuleMgr; | 246 return new CCodec_ModuleMgr; |
247 } | 247 } |
248 void CCodec_ModuleMgr::Destroy() | 248 void CCodec_ModuleMgr::Destroy() |
249 { | 249 { |
250 delete this; | 250 delete this; |
251 } | 251 } |
252 class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder | 252 class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder |
253 { | 253 { |
254 public: | 254 public: |
255 CCodec_RLScanlineDecoder(); | 255 CCodec_RLScanlineDecoder(); |
256 virtual ~CCodec_RLScanlineDecoder(); | 256 virtual ~CCodec_RLScanlineDecoder(); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 m_SrcOffset ++; | 426 m_SrcOffset ++; |
427 GetNextOperator(); | 427 GetNextOperator(); |
428 return; | 428 return; |
429 } | 429 } |
430 count -= used_bytes; | 430 count -= used_bytes; |
431 m_Operator = 257 - count; | 431 m_Operator = 257 - count; |
432 } | 432 } |
433 ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE sr
c_buf, FX_DWORD src_size, int width, int height, | 433 ICodec_ScanlineDecoder* CCodec_BasicModule::CreateRunLengthDecoder(FX_LPCBYTE sr
c_buf, FX_DWORD src_size, int width, int height, |
434 int nComps, int bpc) | 434 int nComps, int bpc) |
435 { | 435 { |
436 CCodec_RLScanlineDecoder* pRLScanlineDecoder = FX_NEW CCodec_RLScanlineDecod
er; | 436 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; |
437 if (pRLScanlineDecoder == NULL) { | |
438 return NULL; | |
439 } | |
440 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp
c)) { | 437 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, bp
c)) { |
441 delete pRLScanlineDecoder; | 438 delete pRLScanlineDecoder; |
442 return NULL; | 439 return NULL; |
443 } | 440 } |
444 return pRLScanlineDecoder; | 441 return pRLScanlineDecoder; |
445 } | 442 } |
OLD | NEW |