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> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 int GetWidth() override { return m_OutputWidth; } | 50 int GetWidth() override { return m_OutputWidth; } |
51 int GetHeight() override { return m_OutputHeight; } | 51 int GetHeight() override { return m_OutputHeight; } |
52 int CountComps() override { return m_nComps; } | 52 int CountComps() override { return m_nComps; } |
53 int GetBPC() override { return m_bpc; } | 53 int GetBPC() override { return m_bpc; } |
54 FX_BOOL IsColorTransformed() override { return m_bColorTransformed; } | 54 FX_BOOL IsColorTransformed() override { return m_bColorTransformed; } |
55 void ClearImageData() override { m_pDataCache.reset(); } | 55 void ClearImageData() override { m_pDataCache.reset(); } |
56 | 56 |
57 protected: | 57 protected: |
58 class ImageDataCache { | 58 class ImageDataCache { |
59 public: | 59 public: |
60 ImageDataCache(int width, int height, int pitch); | 60 ImageDataCache(int width, int height, FX_DWORD pitch); |
61 ~ImageDataCache(); | 61 ~ImageDataCache(); |
62 | 62 |
63 bool AllocateCache(); | 63 bool AllocateCache(); |
64 void AppendLine(const uint8_t* line); | 64 void AppendLine(const uint8_t* line); |
65 | 65 |
66 int NumLines() const { return m_nCachedLines; } | 66 int NumLines() const { return m_nCachedLines; } |
67 const uint8_t* GetLine(int line) const; | 67 const uint8_t* GetLine(int line) const; |
68 bool IsSameDimensions(int width, int height) const { | 68 bool IsSameDimensions(int width, int height) const { |
69 return width == m_Width && height == m_Height; | 69 return width == m_Width && height == m_Height; |
70 } | 70 } |
71 | 71 |
72 private: | 72 private: |
73 bool IsValid() const { return m_Data.get() != nullptr; } | 73 bool IsValid() const { return m_Data.get() != nullptr; } |
74 | 74 |
75 const int m_Width; | 75 const int m_Width; |
76 const int m_Height; | 76 const int m_Height; |
77 const int m_Pitch; | 77 const FX_DWORD m_Pitch; |
78 int m_nCachedLines; | 78 int m_nCachedLines; |
79 nonstd::unique_ptr<uint8_t, FxFreeDeleter> m_Data; | 79 nonstd::unique_ptr<uint8_t, FxFreeDeleter> m_Data; |
80 }; | 80 }; |
81 | 81 |
82 virtual FX_BOOL v_Rewind() = 0; | 82 virtual FX_BOOL v_Rewind() = 0; |
83 virtual uint8_t* v_GetNextLine() = 0; | 83 virtual uint8_t* v_GetNextLine() = 0; |
84 virtual void v_DownScale(int dest_width, int dest_height) = 0; | 84 virtual void v_DownScale(int dest_width, int dest_height) = 0; |
85 | 85 |
86 uint8_t* ReadNextLine(); | 86 uint8_t* ReadNextLine(); |
87 | 87 |
88 int m_OrigWidth; | 88 int m_OrigWidth; |
89 int m_OrigHeight; | 89 int m_OrigHeight; |
90 int m_DownScale; | 90 int m_DownScale; |
91 int m_OutputWidth; | 91 int m_OutputWidth; |
92 int m_OutputHeight; | 92 int m_OutputHeight; |
93 int m_nComps; | 93 int m_nComps; |
94 int m_bpc; | 94 int m_bpc; |
95 int m_Pitch; | 95 FX_DWORD m_Pitch; |
96 FX_BOOL m_bColorTransformed; | 96 FX_BOOL m_bColorTransformed; |
97 int m_NextLine; | 97 int m_NextLine; |
98 uint8_t* m_pLastScanline; | 98 uint8_t* m_pLastScanline; |
99 nonstd::unique_ptr<ImageDataCache> m_pDataCache; | 99 nonstd::unique_ptr<ImageDataCache> m_pDataCache; |
100 }; | 100 }; |
101 | 101 |
102 class CCodec_FaxModule : public ICodec_FaxModule { | 102 class CCodec_FaxModule : public ICodec_FaxModule { |
103 public: | 103 public: |
104 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, | 104 virtual ICodec_ScanlineDecoder* CreateDecoder(const uint8_t* src_buf, |
105 FX_DWORD src_size, | 105 FX_DWORD src_size, |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, | 325 OPJ_SIZE_T opj_read_from_memory(void* p_buffer, |
326 OPJ_SIZE_T nb_bytes, | 326 OPJ_SIZE_T nb_bytes, |
327 void* p_user_data); | 327 void* p_user_data); |
328 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, | 328 OPJ_SIZE_T opj_write_from_memory(void* p_buffer, |
329 OPJ_SIZE_T nb_bytes, | 329 OPJ_SIZE_T nb_bytes, |
330 void* p_user_data); | 330 void* p_user_data); |
331 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 331 OPJ_OFF_T opj_skip_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); |
332 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); | 332 OPJ_BOOL opj_seek_from_memory(OPJ_OFF_T nb_bytes, void* p_user_data); |
333 | 333 |
334 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ | 334 #endif // CORE_SRC_FXCODEC_CODEC_CODEC_INT_H_ |
OLD | NEW |