| 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 | 8 |
| 9 #include <cmath> | 9 #include <cmath> |
| 10 | 10 |
| 11 #include "../../../../third_party/base/logging.h" | 11 #include "../../../../third_party/base/logging.h" |
| 12 #include "../../../include/fxcrt/fx_safe_types.h" | 12 #include "../../../include/fxcrt/fx_safe_types.h" |
| 13 #include "codec_int.h" | 13 #include "codec_int.h" |
| 14 | 14 |
| 15 CCodec_ModuleMgr::CCodec_ModuleMgr() | 15 CCodec_ModuleMgr::CCodec_ModuleMgr() |
| 16 : m_pBasicModule(new CCodec_BasicModule), | 16 : m_pBasicModule(new CCodec_BasicModule), |
| 17 m_pFaxModule(new CCodec_FaxModule), | 17 m_pFaxModule(new CCodec_FaxModule), |
| 18 m_pJpegModule(new CCodec_JpegModule), | 18 m_pJpegModule(new CCodec_JpegModule), |
| 19 m_pJpxModule(new CCodec_JpxModule), | 19 m_pJpxModule(new CCodec_JpxModule), |
| 20 m_pJbig2Module(new CCodec_Jbig2Module), | 20 m_pJbig2Module(new CCodec_Jbig2Module), |
| 21 m_pIccModule(new CCodec_IccModule), | 21 m_pIccModule(new CCodec_IccModule), |
| 22 #ifndef PDF_ENABLE_XFA |
| 22 m_pFlateModule(new CCodec_FlateModule) {} | 23 m_pFlateModule(new CCodec_FlateModule) {} |
| 24 #else |
| 25 m_pFlateModule(new CCodec_FlateModule), |
| 26 m_pPngModule(new CCodec_PngModule), |
| 27 m_pGifModule(new CCodec_GifModule), |
| 28 m_pBmpModule(new CCodec_BmpModule), |
| 29 m_pTiffModule(new CCodec_TiffModule) {} |
| 30 #endif |
| 23 | 31 |
| 24 CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width, | 32 CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width, |
| 25 int height, | 33 int height, |
| 26 int pitch) | 34 int pitch) |
| 27 : m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) { | 35 : m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) { |
| 28 } | 36 } |
| 29 | 37 |
| 30 CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() { | 38 CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() { |
| 31 } | 39 } |
| 32 | 40 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 } | 254 } |
| 247 } | 255 } |
| 248 return is_negative ? -ret : ret; | 256 return is_negative ? -ret : ret; |
| 249 } | 257 } |
| 250 FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, | 258 FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, |
| 251 FX_DWORD src_size, | 259 FX_DWORD src_size, |
| 252 uint8_t*& dest_buf, | 260 uint8_t*& dest_buf, |
| 253 FX_DWORD& dest_size) { | 261 FX_DWORD& dest_size) { |
| 254 return FALSE; | 262 return FALSE; |
| 255 } | 263 } |
| 264 #ifdef PDF_ENABLE_XFA |
| 265 CFX_DIBAttribute::CFX_DIBAttribute() |
| 266 : m_nXDPI(-1), |
| 267 m_nYDPI(-1), |
| 268 m_fAspectRatio(-1.0f), |
| 269 m_wDPIUnit(0), |
| 270 m_nGifLeft(0), |
| 271 m_nGifTop(0), |
| 272 m_pGifLocalPalette(nullptr), |
| 273 m_nGifLocalPalNum(0), |
| 274 m_nBmpCompressType(0) { |
| 275 FXSYS_memset(m_strTime, 0, sizeof(m_strTime)); |
| 276 } |
| 277 CFX_DIBAttribute::~CFX_DIBAttribute() { |
| 278 for (const auto& pair : m_Exif) |
| 279 FX_Free(pair.second); |
| 280 } |
| 281 |
| 282 #endif |
| 256 class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { | 283 class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { |
| 257 public: | 284 public: |
| 258 CCodec_RLScanlineDecoder(); | 285 CCodec_RLScanlineDecoder(); |
| 259 ~CCodec_RLScanlineDecoder() override; | 286 ~CCodec_RLScanlineDecoder() override; |
| 260 | 287 |
| 261 FX_BOOL Create(const uint8_t* src_buf, | 288 FX_BOOL Create(const uint8_t* src_buf, |
| 262 FX_DWORD src_size, | 289 FX_DWORD src_size, |
| 263 int width, | 290 int width, |
| 264 int height, | 291 int height, |
| 265 int nComps, | 292 int nComps, |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 int nComps, | 466 int nComps, |
| 440 int bpc) { | 467 int bpc) { |
| 441 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; | 468 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; |
| 442 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, | 469 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, |
| 443 bpc)) { | 470 bpc)) { |
| 444 delete pRLScanlineDecoder; | 471 delete pRLScanlineDecoder; |
| 445 return NULL; | 472 return NULL; |
| 446 } | 473 } |
| 447 return pRLScanlineDecoder; | 474 return pRLScanlineDecoder; |
| 448 } | 475 } |
| OLD | NEW |