diff options
author | thestig <thestig@chromium.org> | 2016-06-09 18:29:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-09 18:29:35 -0700 |
commit | fcf61b39ee597c73e80ba789833fb7fe49878422 (patch) | |
tree | 5517ae2d3d581a49c1c756f48c34f02468ae38d7 /core/fxcodec/codec/include | |
parent | 342de0bef86b4a7be5599a02a6ff4a6e07328b11 (diff) | |
download | pdfium-fcf61b39ee597c73e80ba789833fb7fe49878422.tar.xz |
Clean up fx_codec_tiff.cpp.
Fix regressions from commit 4997b22.
BUG=618164
Review-Url: https://codereview.chromium.org/2053573003
Diffstat (limited to 'core/fxcodec/codec/include')
-rw-r--r-- | core/fxcodec/codec/include/ccodec_progressivedecoder.h | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/core/fxcodec/codec/include/ccodec_progressivedecoder.h b/core/fxcodec/codec/include/ccodec_progressivedecoder.h index 5421d73494..5774371ff1 100644 --- a/core/fxcodec/codec/include/ccodec_progressivedecoder.h +++ b/core/fxcodec/codec/include/ccodec_progressivedecoder.h @@ -7,6 +7,8 @@ #ifndef CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_ #define CORE_FXCODEC_CODEC_INCLUDE_CCODEC_PROGRESSIVEDECODER_H_ +#include <vector> + #include "core/fxcodec/include/fx_codec_def.h" #include "core/fxcrt/include/fx_system.h" #include "core/fxge/include/fx_dib.h" @@ -40,7 +42,7 @@ class CCodec_ProgressiveDecoder { FXCodec_Cmyk = 0x120 }; - CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); + explicit CCodec_ProgressiveDecoder(CCodec_ModuleMgr* pCodecMgr); ~CCodec_ProgressiveDecoder(); FXCODEC_STATUS LoadImageInfo(IFX_FileRead* pFile, @@ -73,8 +75,8 @@ class CCodec_ProgressiveDecoder { class CFXCODEC_WeightTable { public: - CFXCODEC_WeightTable() { m_pWeightTables = nullptr; } - ~CFXCODEC_WeightTable() { FX_Free(m_pWeightTables); } + CFXCODEC_WeightTable() {} + ~CFXCODEC_WeightTable() {} void Calc(int dest_len, int dest_min, @@ -84,37 +86,41 @@ class CCodec_ProgressiveDecoder { int src_max, FX_BOOL bInterpol); PixelWeight* GetPixelWeight(int pixel) { - return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize); + return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() + + (pixel - m_DestMin) * m_ItemSize); } - int m_DestMin, m_ItemSize; - uint8_t* m_pWeightTables; + int m_DestMin; + int m_ItemSize; + std::vector<uint8_t> m_pWeightTables; }; class CFXCODEC_HorzTable { public: - CFXCODEC_HorzTable() { m_pWeightTables = nullptr; } - ~CFXCODEC_HorzTable() { FX_Free(m_pWeightTables); } + CFXCODEC_HorzTable() {} + ~CFXCODEC_HorzTable() {} void Calc(int dest_len, int src_len, FX_BOOL bInterpol); PixelWeight* GetPixelWeight(int pixel) { - return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize); + return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() + + pixel * m_ItemSize); } int m_ItemSize; - uint8_t* m_pWeightTables; + std::vector<uint8_t> m_pWeightTables; }; class CFXCODEC_VertTable { public: - CFXCODEC_VertTable() { m_pWeightTables = nullptr; } - ~CFXCODEC_VertTable() { FX_Free(m_pWeightTables); } + CFXCODEC_VertTable() {} + ~CFXCODEC_VertTable() {} void Calc(int dest_len, int src_len); PixelWeight* GetPixelWeight(int pixel) { - return (PixelWeight*)(m_pWeightTables + pixel * m_ItemSize); + return reinterpret_cast<PixelWeight*>(m_pWeightTables.data() + + pixel * m_ItemSize); } int m_ItemSize; - uint8_t* m_pWeightTables; + std::vector<uint8_t> m_pWeightTables; }; IFX_FileRead* m_pFile; |