diff options
author | Lei Zhang <thestig@chromium.org> | 2015-10-01 14:08:32 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-10-01 14:08:32 -0700 |
commit | e95f39f10400746f0dc49c8afe3b3f21cdbbf381 (patch) | |
tree | f40e88e0427b53f36d1e8f0dff339de45f650fb4 /core/include | |
parent | 61d25619b1e7647b10689352039966a1394feae6 (diff) | |
download | pdfium-e95f39f10400746f0dc49c8afe3b3f21cdbbf381.tar.xz |
Merge to XFA: Clean up some image decoder classes:
- Use std::vector<uint8_t> instead of raw uint8_t*
- Make ICodec_ScanlineDecoder::GetScanline() return const uint8_t*
- Add FxFreeDeleter, use it in CCodec_ImageDataCache.
- Make CCodec_ImageDataCache encapsulate its data members.
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1361053002 .
(cherry picked from commit 022da0014faa103901ec107ed6a33e5ab00c7931)
Review URL: https://codereview.chromium.org/1372993003 .
Diffstat (limited to 'core/include')
-rw-r--r-- | core/include/fxcodec/fx_codec.h | 14 | ||||
-rw-r--r-- | core/include/fxcrt/fx_basic.h | 4 |
2 files changed, 13 insertions, 5 deletions
diff --git a/core/include/fxcodec/fx_codec.h b/core/include/fxcodec/fx_codec.h index 796fbf0c11..0cacbde24d 100644 --- a/core/include/fxcodec/fx_codec.h +++ b/core/include/fxcodec/fx_codec.h @@ -7,6 +7,8 @@ #ifndef CORE_INCLUDE_FXCODEC_FX_CODEC_H_ #define CORE_INCLUDE_FXCODEC_FX_CODEC_H_ +#include <vector> + #include "../../../third_party/base/nonstd_unique_ptr.h" #include "../fxcrt/fx_basic.h" #include "../fxcrt/fx_coordinates.h" @@ -80,6 +82,7 @@ class ICodec_BasicModule { int nComps, int bpc) = 0; }; + class ICodec_ScanlineDecoder { public: virtual ~ICodec_ScanlineDecoder() {} @@ -88,7 +91,7 @@ class ICodec_ScanlineDecoder { virtual void DownScale(int dest_width, int dest_height) = 0; - virtual uint8_t* GetScanline(int line) = 0; + virtual const uint8_t* GetScanline(int line) = 0; virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) = 0; @@ -104,6 +107,7 @@ class ICodec_ScanlineDecoder { virtual void ClearImageData() = 0; }; + class ICodec_FlateModule { public: virtual ~ICodec_FlateModule() {} @@ -228,10 +232,10 @@ class ICodec_JpxModule { FX_DWORD* height, FX_DWORD* components) = 0; - virtual FX_BOOL Decode(CJPX_Decoder* pDecoder, - uint8_t* dest_data, - int pitch, - uint8_t* offsets) = 0; + virtual bool Decode(CJPX_Decoder* pDecoder, + uint8_t* dest_data, + int pitch, + const std::vector<uint8_t>& offsets) = 0; virtual void DestroyDecoder(CJPX_Decoder* pDecoder) = 0; }; diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h index fa536004d4..e6b7f69007 100644 --- a/core/include/fxcrt/fx_basic.h +++ b/core/include/fxcrt/fx_basic.h @@ -1085,6 +1085,10 @@ class CFX_AutoRestorer { T m_OldValue; }; +struct FxFreeDeleter { + inline void operator()(void* ptr) const { FX_Free(ptr); } +}; + // Used with nonstd::unique_ptr to Release() objects that can't be deleted. template <class T> struct ReleaseDeleter { |