Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(783)

Side by Side Diff: core/src/fxcodec/codec/fx_codec.cpp

Issue 1471323004: Inflict PPDF_ENABLE_XFA ifdefs on XFA core/ (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
25 m_pFlateModule(new CCodec_FlateModule) {
26 }
27 #else
24 m_pFlateModule(new CCodec_FlateModule), 28 m_pFlateModule(new CCodec_FlateModule),
25 m_pPngModule(new CCodec_PngModule), 29 m_pPngModule(new CCodec_PngModule),
26 m_pGifModule(new CCodec_GifModule), 30 m_pGifModule(new CCodec_GifModule),
27 m_pBmpModule(new CCodec_BmpModule), 31 m_pBmpModule(new CCodec_BmpModule),
28 m_pTiffModule(new CCodec_TiffModule) {} 32 m_pTiffModule(new CCodec_TiffModule) {
Lei Zhang 2015/11/24 23:38:10 If the ordering does not matter, you can put m_pFl
Tom Sepez 2015/11/25 18:51:46 That's a great idea.
33 }
34 #endif
29 35
30 CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width, 36 CCodec_ScanlineDecoder::ImageDataCache::ImageDataCache(int width,
31 int height, 37 int height,
32 FX_DWORD pitch) 38 FX_DWORD pitch)
33 : m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) {} 39 : m_Width(width), m_Height(height), m_Pitch(pitch), m_nCachedLines(0) {}
34 40
35 CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() { 41 CCodec_ScanlineDecoder::ImageDataCache::~ImageDataCache() {
36 } 42 }
37 43
38 bool CCodec_ScanlineDecoder::ImageDataCache::AllocateCache() { 44 bool CCodec_ScanlineDecoder::ImageDataCache::AllocateCache() {
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 return is_negative ? -ret : ret; 260 return is_negative ? -ret : ret;
255 } 261 }
256 #undef EXPONENT_DETECT 262 #undef EXPONENT_DETECT
257 263
258 FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf, 264 FX_BOOL CCodec_BasicModule::A85Encode(const uint8_t* src_buf,
259 FX_DWORD src_size, 265 FX_DWORD src_size,
260 uint8_t*& dest_buf, 266 uint8_t*& dest_buf,
261 FX_DWORD& dest_size) { 267 FX_DWORD& dest_size) {
262 return FALSE; 268 return FALSE;
263 } 269 }
270 #ifdef PDF_ENABLE_XFA
264 CFX_DIBAttribute::CFX_DIBAttribute() 271 CFX_DIBAttribute::CFX_DIBAttribute()
265 : m_nXDPI(-1), 272 : m_nXDPI(-1),
266 m_nYDPI(-1), 273 m_nYDPI(-1),
267 m_fAspectRatio(-1.0f), 274 m_fAspectRatio(-1.0f),
268 m_wDPIUnit(0), 275 m_wDPIUnit(0),
269 m_nGifLeft(0), 276 m_nGifLeft(0),
270 m_nGifTop(0), 277 m_nGifTop(0),
271 m_pGifLocalPalette(nullptr), 278 m_pGifLocalPalette(nullptr),
272 m_nGifLocalPalNum(0), 279 m_nGifLocalPalNum(0),
273 m_nBmpCompressType(0) { 280 m_nBmpCompressType(0) {
274 FXSYS_memset(m_strTime, 0, sizeof(m_strTime)); 281 FXSYS_memset(m_strTime, 0, sizeof(m_strTime));
275 } 282 }
276 CFX_DIBAttribute::~CFX_DIBAttribute() { 283 CFX_DIBAttribute::~CFX_DIBAttribute() {
277 for (const auto& pair : m_Exif) 284 for (const auto& pair : m_Exif)
278 FX_Free(pair.second); 285 FX_Free(pair.second);
279 } 286 }
280 287
288 #endif
281 class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder { 289 class CCodec_RLScanlineDecoder : public CCodec_ScanlineDecoder {
282 public: 290 public:
283 CCodec_RLScanlineDecoder(); 291 CCodec_RLScanlineDecoder();
284 ~CCodec_RLScanlineDecoder() override; 292 ~CCodec_RLScanlineDecoder() override;
285 293
286 FX_BOOL Create(const uint8_t* src_buf, 294 FX_BOOL Create(const uint8_t* src_buf,
287 FX_DWORD src_size, 295 FX_DWORD src_size,
288 int width, 296 int width,
289 int height, 297 int height,
290 int nComps, 298 int nComps,
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 int nComps, 483 int nComps,
476 int bpc) { 484 int bpc) {
477 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder; 485 CCodec_RLScanlineDecoder* pRLScanlineDecoder = new CCodec_RLScanlineDecoder;
478 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps, 486 if (!pRLScanlineDecoder->Create(src_buf, src_size, width, height, nComps,
479 bpc)) { 487 bpc)) {
480 delete pRLScanlineDecoder; 488 delete pRLScanlineDecoder;
481 return NULL; 489 return NULL;
482 } 490 }
483 return pRLScanlineDecoder; 491 return pRLScanlineDecoder;
484 } 492 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698