| OLD | NEW |
| 1 | 1 |
| 2 // Copyright 2014 PDFium Authors. All rights reserved. | 2 // Copyright 2014 PDFium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 6 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 7 | 7 |
| 8 #include "core/include/fxcodec/fx_codec.h" | 8 #include "core/include/fxcodec/fx_codec.h" |
| 9 | 9 |
| 10 #include <cmath> | 10 #include <cmath> |
| 11 | 11 |
| 12 #include "codec_int.h" | 12 #include "codec_int.h" |
| 13 #include "core/include/fxcrt/fx_ext.h" | 13 #include "core/include/fxcrt/fx_ext.h" |
| 14 #include "core/include/fxcrt/fx_safe_types.h" | 14 #include "core/include/fxcrt/fx_safe_types.h" |
| 15 #include "third_party/base/logging.h" | 15 #include "third_party/base/logging.h" |
| 16 | 16 |
| 17 CCodec_ModuleMgr::CCodec_ModuleMgr() | 17 CCodec_ModuleMgr::CCodec_ModuleMgr() |
| 18 : m_pBasicModule(new CCodec_BasicModule), | 18 : m_pBasicModule(new CCodec_BasicModule), |
| 19 m_pFaxModule(new CCodec_FaxModule), | 19 m_pFaxModule(new CCodec_FaxModule), |
| 20 m_pJpegModule(new CCodec_JpegModule), | 20 m_pJpegModule(new CCodec_JpegModule), |
| 21 m_pJpxModule(new CCodec_JpxModule), | 21 m_pJpxModule(new CCodec_JpxModule), |
| 22 m_pJbig2Module(new CCodec_Jbig2Module), | 22 m_pJbig2Module(new CCodec_Jbig2Module), |
| 23 m_pIccModule(new CCodec_IccModule), | 23 m_pIccModule(new CCodec_IccModule), |
| 24 #ifndef PDF_ENABLE_XFA |
| 24 m_pFlateModule(new CCodec_FlateModule) {} | 25 m_pFlateModule(new CCodec_FlateModule) {} |
| 26 #else |
| 27 m_pFlateModule(new CCodec_FlateModule), |
| 28 m_pPngModule(new CCodec_PngModule), |
| 29 m_pGifModule(new CCodec_GifModule), |
| 30 m_pBmpModule(new CCodec_BmpModule), |
| 31 m_pTiffModule(new CCodec_TiffModule) {} |
| 32 #endif |
| 25 | 33 |
| 26 CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width, | 34 CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width, |
| 27 int height, | 35 int height, |
| 28 FX_DWORD pitch) | 36 FX_DWORD pitch) |
| 29 : m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) {} | 37 : m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) {} |
| 30 | 38 |
| 31 CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() { | 39 CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() { |
| 32 } | 40 } |
| 33 | 41 |
| 34 bool CCodec_ScanlineDecoder::ImageDataCache::AllocateCache() { | 42 bool CCodec_ScanlineDecoder::ImageDataCache::AllocateCache() { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 return is_negative ? -ret : ret; | 258 return is_negative ? -ret : ret; |
| 251 } | 259 } |
| 252 #undef EXPONENT_DETECT | 260 #undef EXPONENT_DETECT |
| 253 | 261 |
| 254 FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, | 262 FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, |
| 255 FX_DWORD src_size, | 263 FX_DWORD src_size, |
| 256 uint8_t*& dest_buf, | 264 uint8_t*& dest_buf, |
| 257 FX_DWORD& dest_size) { | 265 FX_DWORD& dest_size) { |
| 258 return FALSE; | 266 return FALSE; |
| 259 } | 267 } |
| 268 #ifdef PDF_ENABLE_XFA |
| 269 CFX_DIBAttribute::CFX_DIBAttribute() |
| 270 : m_nXDPI(-1), |
| 271 m_nYDPI(-1), |
| 272 m_fAspectRatio(-1.0f), |
| 273 m_wDPIUnit(0), |
| 274 m_nGifLeft(0), |
| 275 m_nGifTop(0), |
| 276 m_pGifLocalPalette(nullptr), |
| 277 m_nGifLocalPalNum(0), |
| 278 m_nBmpCompressType(0) { |
| 279 FXSYS_memset(m_strTime, 0, sizeof(m_strTime)); |
| 280 } |
| 281 CFX_DIBAttribute::~CFX_DIBAttribute() { |
| 282 for (const auto& pair : m_Exif) |
| 283 FX_Free(pair.second); |
| 284 } |
| 285 |
| 286 #endif |
| 260 class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { | 287 class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { |
| 261 public: | 288 public: |
| 262 CCodec_RLScanlineDecoder(); | 289 CCodec_RLScanlineDecoder(); |
| 263 ~CCodec_RLScanlineDecoder() override; | 290 ~CCodec_RLScanlineDecoder() override; |
| 264 | 291 |
| 265 FX_BOOL Create(const uint8_t* src_buf, | 292 FX_BOOL Create(const uint8_t* src_buf, |
| 266 FX_DWORD src_size, | 293 FX_DWORD src_size, |
| 267 int width, | 294 int width, |
| 268 int height, | 295 int height, |
| 269 int nComps, | 296 int nComps, |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 int nComps, | 481 int nComps, |
| 455 int bpc) { | 482 int bpc) { |
| 456 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; | 483 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; |
| 457 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, | 484 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, |
| 458 bpc)) { | 485 bpc)) { |
| 459 delete pRLScanlineDecoder; | 486 delete pRLScanlineDecoder; |
| 460 return NULL; | 487 return NULL; |
| 461 } | 488 } |
| 462 return pRLScanlineDecoder; | 489 return pRLScanlineDecoder; |
| 463 } | 490 } |
| OLD | NEW |