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_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 7 #ifndef CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ |
8 #define CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 8 #define CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ |
9 | 9 |
10 #include <limits.h> | 10 #include <limits.h> |
| 11 |
11 #include <list> | 12 #include <list> |
12 #include <map> | 13 #include <map> |
| 14 #include <memory> |
13 | 15 |
14 #include "core/include/fxcodec/fx_codec.h" | 16 #include "core/include/fxcodec/fx_codec.h" |
15 #include "core/src/fxcodec/jbig2/JBig2_Context.h" | 17 #include "core/src/fxcodec/jbig2/JBig2_Context.h" |
16 #include "third_party/base/nonstd_unique_ptr.h" | |
17 #include "third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T. | 18 #include "third_party/libopenjpeg20/openjpeg.h" // For OPJ_SIZE_T. |
18 | 19 |
19 class CFX_IccProfileCache; | 20 class CFX_IccProfileCache; |
20 class CFX_IccTransformCache; | 21 class CFX_IccTransformCache; |
21 | 22 |
22 class CCodec_BasicModule : public ICodec_BasicModule { | 23 class CCodec_BasicModule : public ICodec_BasicModule { |
23 public: | 24 public: |
24 // ICodec_BasicModule: | 25 // ICodec_BasicModule: |
25 FX_BOOL RunLengthEncode(const uint8_t* src_buf, | 26 FX_BOOL RunLengthEncode(const uint8_t* src_buf, |
26 FX_DWORD src_size, | 27 FX_DWORD src_size, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 return width == m_Width && height == m_Height; | 71 return width == m_Width && height == m_Height; |
71 } | 72 } |
72 | 73 |
73 private: | 74 private: |
74 bool IsValid() const { return m_Data.get() != nullptr; } | 75 bool IsValid() const { return m_Data.get() != nullptr; } |
75 | 76 |
76 const int m_Width; | 77 const int m_Width; |
77 const int m_Height; | 78 const int m_Height; |
78 const FX_DWORD m_Pitch; | 79 const FX_DWORD m_Pitch; |
79 int m_nCachedLines; | 80 int m_nCachedLines; |
80 nonstd::unique_ptr<uint8_t, FxFreeDeleter> m_Data; | 81 std::unique_ptr<uint8_t, FxFreeDeleter> m_Data; |
81 }; | 82 }; |
82 | 83 |
83 virtual FX_BOOL v_Rewind() = 0; | 84 virtual FX_BOOL v_Rewind() = 0; |
84 virtual uint8_t* v_GetNextLine() = 0; | 85 virtual uint8_t* v_GetNextLine() = 0; |
85 virtual void v_DownScale(int dest_width, int dest_height) = 0; | 86 virtual void v_DownScale(int dest_width, int dest_height) = 0; |
86 | 87 |
87 uint8_t* ReadNextLine(); | 88 uint8_t* ReadNextLine(); |
88 | 89 |
89 int m_OrigWidth; | 90 int m_OrigWidth; |
90 int m_OrigHeight; | 91 int m_OrigHeight; |
91 int m_DownScale; | 92 int m_DownScale; |
92 int m_OutputWidth; | 93 int m_OutputWidth; |
93 int m_OutputHeight; | 94 int m_OutputHeight; |
94 int m_nComps; | 95 int m_nComps; |
95 int m_bpc; | 96 int m_bpc; |
96 FX_DWORD m_Pitch; | 97 FX_DWORD m_Pitch; |
97 FX_BOOL m_bColorTransformed; | 98 FX_BOOL m_bColorTransformed; |
98 int m_NextLine; | 99 int m_NextLine; |
99 uint8_t* m_pLastScanline; | 100 uint8_t* m_pLastScanline; |
100 nonstd::unique_ptr<ImageDataCache> m_pDataCache; | 101 std::unique_ptr<ImageDataCache> m_pDataCache; |
101 }; | 102 }; |
102 | 103 |
103 class CCodec_FaxModule : public ICodec_FaxModule { | 104 class CCodec_FaxModule : public ICodec_FaxModule { |
104 public: | 105 public: |
105 // ICodec_FaxModule: | 106 // ICodec_FaxModule: |
106 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 107 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, |
107 FX_DWORD src_size, | 108 FX_DWORD src_size, |
108 int width, | 109 int width, |
109 int height, | 110 int height, |
110 int K, | 111 int K, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, | 322 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, |
322 OPJ_SIZE_T nb_bytes, | 323 OPJ_SIZE_T nb_bytes, |
323 void* p_user_data); | 324 void* p_user_data); |
324 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, | 325 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, |
325 OPJ_SIZE_T nb_bytes, | 326 OPJ_SIZE_T nb_bytes, |
326 void* p_user_data); | 327 void* p_user_data); |
327 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 328 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); |
328 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 329 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); |
329 | 330 |
330 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 331 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ |
OLD | NEW |