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