Chromium Code Reviews| 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 #ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_H_ | 7 #ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_H_ |
| 8 #define CORE_INCLUDE_FXCODEC_FX_CODEC_H_ | 8 #define CORE_INCLUDE_FXCODEC_FX_CODEC_H_ |
| 9 | 9 |
| 10 #ifdef PDF_ENABLE_XFA | |
| 11 #include <map> | 10 #include <map> |
| 12 #endif | |
| 13 #include <vector> | 11 #include <vector> |
| 14 | 12 |
| 13 #include "core/include/fxcrt/fx_coordinates.h" // For FX_RECT. | |
|
Lei Zhang
2015/11/25 21:49:01
after fx_basic
Tom Sepez
2015/11/25 22:05:06
Done. Also added full path for fx_codec_def and re
| |
| 15 #include "core/include/fxcrt/fx_basic.h" | 14 #include "core/include/fxcrt/fx_basic.h" |
| 16 #include "fx_codec_def.h" | 15 #include "fx_codec_def.h" |
| 17 #include "third_party/base/nonstd_unique_ptr.h" | 16 #include "third_party/base/nonstd_unique_ptr.h" |
| 18 | 17 |
| 19 #ifdef PDF_ENABLE_XFA | |
| 20 #include "../fxcrt/fx_coordinates.h" // For FX_RECT. | |
| 21 | |
| 22 #endif | |
| 23 class CFX_DIBSource; | 18 class CFX_DIBSource; |
| 24 class CJPX_Decoder; | 19 class CJPX_Decoder; |
| 25 class CPDF_PrivateData; | 20 class CPDF_PrivateData; |
| 26 class CPDF_StreamAcc; | 21 class CPDF_StreamAcc; |
| 27 #ifndef PDF_ENABLE_XFA | |
| 28 class ICodec_ScanlineDecoder; | |
| 29 #endif | |
| 30 class ICodec_BasicModule; | 22 class ICodec_BasicModule; |
| 31 class ICodec_FaxModule; | 23 class ICodec_FaxModule; |
| 32 #ifdef PDF_ENABLE_XFA | |
| 33 class ICodec_FlateModule; | 24 class ICodec_FlateModule; |
| 34 class ICodec_IccModule; | 25 class ICodec_IccModule; |
| 35 class ICodec_Jbig2Encoder; | 26 class ICodec_Jbig2Encoder; |
| 36 class ICodec_Jbig2Module; | 27 class ICodec_Jbig2Module; |
| 37 #endif | |
| 38 class ICodec_JpegModule; | 28 class ICodec_JpegModule; |
| 39 class ICodec_JpxModule; | 29 class ICodec_JpxModule; |
| 40 #ifndef PDF_ENABLE_XFA | |
| 41 class ICodec_Jbig2Module; | |
| 42 class ICodec_IccModule; | |
| 43 class ICodec_FlateModule; | |
| 44 class ICodec_Jbig2Encoder; | |
| 45 #endif | |
| 46 class ICodec_ScanlineDecoder; | 30 class ICodec_ScanlineDecoder; |
| 47 | 31 |
| 48 #ifdef PDF_ENABLE_XFA | 32 #ifdef PDF_ENABLE_XFA |
| 49 class ICodec_BmpModule; | 33 class ICodec_BmpModule; |
| 50 class ICodec_GifModule; | 34 class ICodec_GifModule; |
| 51 class ICodec_PngModule; | 35 class ICodec_PngModule; |
| 52 class ICodec_ProgressiveDecoder; | 36 class ICodec_ProgressiveDecoder; |
| 53 class ICodec_TiffModule; | 37 class ICodec_TiffModule; |
| 38 #endif // PDF_ENABLE_XFA | |
| 54 | 39 |
| 40 #ifdef PDF_ENABLE_XFA | |
| 55 class CFX_DIBAttribute { | 41 class CFX_DIBAttribute { |
| 56 public: | 42 public: |
| 57 CFX_DIBAttribute(); | 43 CFX_DIBAttribute(); |
| 58 ~CFX_DIBAttribute(); | 44 ~CFX_DIBAttribute(); |
| 59 | 45 |
| 60 int32_t m_nXDPI; | 46 int32_t m_nXDPI; |
| 61 int32_t m_nYDPI; | 47 int32_t m_nYDPI; |
| 62 FX_FLOAT m_fAspectRatio; | 48 FX_FLOAT m_fAspectRatio; |
| 63 FX_WORD m_wDPIUnit; | 49 FX_WORD m_wDPIUnit; |
| 64 CFX_ByteString m_strAuthor; | 50 CFX_ByteString m_strAuthor; |
| 65 uint8_t m_strTime[20]; | 51 uint8_t m_strTime[20]; |
| 66 int32_t m_nGifLeft; | 52 int32_t m_nGifLeft; |
| 67 int32_t m_nGifTop; | 53 int32_t m_nGifTop; |
| 68 FX_DWORD* m_pGifLocalPalette; | 54 FX_DWORD* m_pGifLocalPalette; |
| 69 FX_DWORD m_nGifLocalPalNum; | 55 FX_DWORD m_nGifLocalPalNum; |
| 70 int32_t m_nBmpCompressType; | 56 int32_t m_nBmpCompressType; |
| 71 std::map<FX_DWORD, void*> m_Exif; | 57 std::map<FX_DWORD, void*> m_Exif; |
| 72 }; | 58 }; |
| 59 #endif // PDF_ENABLE_XFA | |
| 73 | 60 |
| 74 #endif | |
| 75 class CCodec_ModuleMgr { | 61 class CCodec_ModuleMgr { |
| 76 public: | 62 public: |
| 77 CCodec_ModuleMgr(); | 63 CCodec_ModuleMgr(); |
| 78 | 64 |
| 79 ICodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); } | 65 ICodec_BasicModule* GetBasicModule() const { return m_pBasicModule.get(); } |
| 80 ICodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); } | 66 ICodec_FaxModule* GetFaxModule() const { return m_pFaxModule.get(); } |
| 81 ICodec_JpegModule* GetJpegModule() const { return m_pJpegModule.get(); } | 67 ICodec_JpegModule* GetJpegModule() const { return m_pJpegModule.get(); } |
| 82 ICodec_JpxModule* GetJpxModule() const { return m_pJpxModule.get(); } | 68 ICodec_JpxModule* GetJpxModule() const { return m_pJpxModule.get(); } |
| 83 ICodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); } | 69 ICodec_Jbig2Module* GetJbig2Module() const { return m_pJbig2Module.get(); } |
| 84 ICodec_IccModule* GetIccModule() const { return m_pIccModule.get(); } | 70 ICodec_IccModule* GetIccModule() const { return m_pIccModule.get(); } |
| 85 ICodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); } | 71 ICodec_FlateModule* GetFlateModule() const { return m_pFlateModule.get(); } |
| 86 | 72 |
| 87 #ifdef PDF_ENABLE_XFA | 73 #ifdef PDF_ENABLE_XFA |
| 88 ICodec_ProgressiveDecoder* CreateProgressiveDecoder(); | 74 ICodec_ProgressiveDecoder* CreateProgressiveDecoder(); |
| 89 ICodec_PngModule* GetPngModule() const { return m_pPngModule.get(); } | 75 ICodec_PngModule* GetPngModule() const { return m_pPngModule.get(); } |
| 90 ICodec_GifModule* GetGifModule() const { return m_pGifModule.get(); } | 76 ICodec_GifModule* GetGifModule() const { return m_pGifModule.get(); } |
| 91 ICodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); } | 77 ICodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); } |
| 92 ICodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); } | 78 ICodec_TiffModule* GetTiffModule() const { return m_pTiffModule.get(); } |
| 79 #endif // PDF_ENABLE_XFA | |
| 93 | 80 |
| 94 #endif | |
| 95 protected: | 81 protected: |
| 96 nonstd::unique_ptr<ICodec_BasicModule> m_pBasicModule; | 82 nonstd::unique_ptr<ICodec_BasicModule> m_pBasicModule; |
| 97 nonstd::unique_ptr<ICodec_FaxModule> m_pFaxModule; | 83 nonstd::unique_ptr<ICodec_FaxModule> m_pFaxModule; |
| 98 nonstd::unique_ptr<ICodec_JpegModule> m_pJpegModule; | 84 nonstd::unique_ptr<ICodec_JpegModule> m_pJpegModule; |
| 99 nonstd::unique_ptr<ICodec_JpxModule> m_pJpxModule; | 85 nonstd::unique_ptr<ICodec_JpxModule> m_pJpxModule; |
| 100 nonstd::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module; | 86 nonstd::unique_ptr<ICodec_Jbig2Module> m_pJbig2Module; |
| 101 nonstd::unique_ptr<ICodec_IccModule> m_pIccModule; | 87 nonstd::unique_ptr<ICodec_IccModule> m_pIccModule; |
| 102 nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule; | |
| 103 #ifdef PDF_ENABLE_XFA | 88 #ifdef PDF_ENABLE_XFA |
| 104 | |
| 105 nonstd::unique_ptr<ICodec_PngModule> m_pPngModule; | 89 nonstd::unique_ptr<ICodec_PngModule> m_pPngModule; |
| 106 nonstd::unique_ptr<ICodec_GifModule> m_pGifModule; | 90 nonstd::unique_ptr<ICodec_GifModule> m_pGifModule; |
| 107 nonstd::unique_ptr<ICodec_BmpModule> m_pBmpModule; | 91 nonstd::unique_ptr<ICodec_BmpModule> m_pBmpModule; |
| 108 nonstd::unique_ptr<ICodec_TiffModule> m_pTiffModule; | 92 nonstd::unique_ptr<ICodec_TiffModule> m_pTiffModule; |
| 109 #endif | 93 #endif // PDF_ENABLE_XFA |
| 94 nonstd::unique_ptr<ICodec_FlateModule> m_pFlateModule; | |
| 110 }; | 95 }; |
| 111 class ICodec_BasicModule { | 96 class ICodec_BasicModule { |
| 112 public: | 97 public: |
| 113 virtual ~ICodec_BasicModule() {} | 98 virtual ~ICodec_BasicModule() {} |
| 114 virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, | 99 virtual FX_BOOL RunLengthEncode(const uint8_t* src_buf, |
| 115 FX_DWORD src_size, | 100 FX_DWORD src_size, |
| 116 uint8_t*& dest_buf, | 101 uint8_t*& dest_buf, |
| 117 FX_DWORD& dest_size) = 0; | 102 FX_DWORD& dest_size) = 0; |
| 118 virtual FX_BOOL A85Encode(const uint8_t* src_buf, | 103 virtual FX_BOOL A85Encode(const uint8_t* src_buf, |
| 119 FX_DWORD src_size, | 104 FX_DWORD src_size, |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 240 FX_DWORD icc_length = 0) = 0; | 225 FX_DWORD icc_length = 0) = 0; |
| 241 | 226 |
| 242 virtual void* Start() = 0; | 227 virtual void* Start() = 0; |
| 243 | 228 |
| 244 virtual void Finish(void* pContext) = 0; | 229 virtual void Finish(void* pContext) = 0; |
| 245 | 230 |
| 246 virtual void Input(void* pContext, | 231 virtual void Input(void* pContext, |
| 247 const uint8_t* src_buf, | 232 const uint8_t* src_buf, |
| 248 FX_DWORD src_size) = 0; | 233 FX_DWORD src_size) = 0; |
| 249 | 234 |
| 235 #ifdef PDF_ENABLE_XFA | |
| 250 virtual int ReadHeader(void* pContext, | 236 virtual int ReadHeader(void* pContext, |
| 251 int* width, | 237 int* width, |
| 252 int* height, | 238 int* height, |
| 253 #ifndef PDF_ENABLE_XFA | |
| 254 int* nComps) = 0; | |
| 255 #else | |
| 256 int* nComps, | 239 int* nComps, |
| 257 CFX_DIBAttribute* pAttribute) = 0; | 240 CFX_DIBAttribute* pAttribute) = 0; |
| 258 #endif | 241 #else // PDF_ENABLE_XFA |
| 242 virtual int ReadHeader(void* pContext, | |
| 243 int* width, | |
| 244 int* height, | |
| 245 int* nComps) = 0; | |
| 246 #endif // PDF_ENABLE_XFA | |
| 259 | 247 |
| 260 virtual int StartScanline(void* pContext, int down_scale) = 0; | 248 virtual int StartScanline(void* pContext, int down_scale) = 0; |
| 261 | 249 |
| 262 virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0; | 250 virtual FX_BOOL ReadScanline(void* pContext, uint8_t* dest_buf) = 0; |
| 263 | 251 |
| 264 virtual FX_DWORD GetAvailInput(void* pContext, | 252 virtual FX_DWORD GetAvailInput(void* pContext, |
| 265 uint8_t** avail_buf_ptr = NULL) = 0; | 253 uint8_t** avail_buf_ptr = NULL) = 0; |
| 266 }; | 254 }; |
| 267 | 255 |
| 268 class ICodec_JpxModule { | 256 class ICodec_JpxModule { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 458 virtual FXCODEC_STATUS StartDecode(class CFX_DIBitmap* pDIBitmap, | 446 virtual FXCODEC_STATUS StartDecode(class CFX_DIBitmap* pDIBitmap, |
| 459 int32_t start_x, | 447 int32_t start_x, |
| 460 int32_t start_y, | 448 int32_t start_y, |
| 461 int32_t size_x, | 449 int32_t size_x, |
| 462 int32_t size_y, | 450 int32_t size_y, |
| 463 int32_t frames = 0, | 451 int32_t frames = 0, |
| 464 FX_BOOL bInterpol = TRUE) = 0; | 452 FX_BOOL bInterpol = TRUE) = 0; |
| 465 | 453 |
| 466 virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = NULL) = 0; | 454 virtual FXCODEC_STATUS ContinueDecode(IFX_Pause* pPause = NULL) = 0; |
| 467 }; | 455 }; |
| 468 #endif | 456 #endif // PDF_ENABLE_XFA |
| 469 class ICodec_Jbig2Encoder { | 457 class ICodec_Jbig2Encoder { |
| 470 public: | 458 public: |
| 471 virtual ~ICodec_Jbig2Encoder() {} | 459 virtual ~ICodec_Jbig2Encoder() {} |
| 472 }; | 460 }; |
| 473 class ICodec_IccModule { | 461 class ICodec_IccModule { |
| 474 public: | 462 public: |
| 475 typedef enum { | 463 typedef enum { |
| 476 IccCS_Unknown = 0, | 464 IccCS_Unknown = 0, |
| 477 IccCS_XYZ, | 465 IccCS_XYZ, |
| 478 IccCS_Lab, | 466 IccCS_Lab, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]); | 547 FX_BOOL MD5ComputeID(const void* buf, FX_DWORD dwSize, uint8_t ID[16]); |
| 560 void FaxG4Decode(const uint8_t* src_buf, | 548 void FaxG4Decode(const uint8_t* src_buf, |
| 561 FX_DWORD src_size, | 549 FX_DWORD src_size, |
| 562 int* pbitpos, | 550 int* pbitpos, |
| 563 uint8_t* dest_buf, | 551 uint8_t* dest_buf, |
| 564 int width, | 552 int width, |
| 565 int height, | 553 int height, |
| 566 int pitch); | 554 int pitch); |
| 567 | 555 |
| 568 #endif // CORE_INCLUDE_FXCODEC_FX_CODEC_H_ | 556 #endif // CORE_INCLUDE_FXCODEC_FX_CODEC_H_ |
| OLD | NEW |