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 class CPDF_ColorSpace; | 22 class CPDF_ColorSpace; |
22 | 23 |
23 class CCodec_BasicModule : public ICodec_BasicModule { | 24 class CCodec_BasicModule : public ICodec_BasicModule { |
24 public: | 25 public: |
25 // ICodec_BasicModule: | 26 // ICodec_BasicModule: |
26 FX_BOOL RunLengthEncode(const uint8_t* src_buf, | 27 FX_BOOL RunLengthEncode(const uint8_t* src_buf, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 return width == m_Width && height == m_Height; | 72 return width == m_Width && height == m_Height; |
72 } | 73 } |
73 | 74 |
74 private: | 75 private: |
75 bool IsValid() const { return m_Data.get() != nullptr; } | 76 bool IsValid() const { return m_Data.get() != nullptr; } |
76 | 77 |
77 const int m_Width; | 78 const int m_Width; |
78 const int m_Height; | 79 const int m_Height; |
79 const FX_DWORD m_Pitch; | 80 const FX_DWORD m_Pitch; |
80 int m_nCachedLines; | 81 int m_nCachedLines; |
81 nonstd::unique_ptr<uint8_t, FxFreeDeleter> m_Data; | 82 std::unique_ptr<uint8_t, FxFreeDeleter> m_Data; |
82 }; | 83 }; |
83 | 84 |
84 virtual FX_BOOL v_Rewind() = 0; | 85 virtual FX_BOOL v_Rewind() = 0; |
85 virtual uint8_t* v_GetNextLine() = 0; | 86 virtual uint8_t* v_GetNextLine() = 0; |
86 virtual void v_DownScale(int dest_width, int dest_height) = 0; | 87 virtual void v_DownScale(int dest_width, int dest_height) = 0; |
87 | 88 |
88 uint8_t* ReadNextLine(); | 89 uint8_t* ReadNextLine(); |
89 | 90 |
90 int m_OrigWidth; | 91 int m_OrigWidth; |
91 int m_OrigHeight; | 92 int m_OrigHeight; |
92 int m_DownScale; | 93 int m_DownScale; |
93 int m_OutputWidth; | 94 int m_OutputWidth; |
94 int m_OutputHeight; | 95 int m_OutputHeight; |
95 int m_nComps; | 96 int m_nComps; |
96 int m_bpc; | 97 int m_bpc; |
97 FX_DWORD m_Pitch; | 98 FX_DWORD m_Pitch; |
98 FX_BOOL m_bColorTransformed; | 99 FX_BOOL m_bColorTransformed; |
99 int m_NextLine; | 100 int m_NextLine; |
100 uint8_t* m_pLastScanline; | 101 uint8_t* m_pLastScanline; |
101 nonstd::unique_ptr<ImageDataCache> m_pDataCache; | 102 std::unique_ptr<ImageDataCache> m_pDataCache; |
102 }; | 103 }; |
103 | 104 |
104 class CCodec_FaxModule : public ICodec_FaxModule { | 105 class CCodec_FaxModule : public ICodec_FaxModule { |
105 public: | 106 public: |
106 // ICodec_FaxModule: | 107 // ICodec_FaxModule: |
107 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 108 ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, |
108 FX_DWORD src_size, | 109 FX_DWORD src_size, |
109 int width, | 110 int width, |
110 int height, | 111 int height, |
111 int K, | 112 int K, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, | 323 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, |
323 OPJ_SIZE_T nb_bytes, | 324 OPJ_SIZE_T nb_bytes, |
324 void* p_user_data); | 325 void* p_user_data); |
325 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, | 326 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, |
326 OPJ_SIZE_T nb_bytes, | 327 OPJ_SIZE_T nb_bytes, |
327 void* p_user_data); | 328 void* p_user_data); |
328 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 329 OPJ_OFF_T opj_skip_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); | 330 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); |
330 | 331 |
331 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 332 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ |
OLD | NEW |