diff options
author | Nicolas Pena <npm@chromium.org> | 2017-06-19 11:36:42 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-19 16:19:54 +0000 |
commit | bc29701214bf96bfacbef04b345bee76fd7bce84 (patch) | |
tree | caa404141f9e13200b380294f9ba5efccc149862 /core/fxcodec/lbmp/fx_bmp.h | |
parent | c533f4b7390afc3b372c0184d274053039ac264d (diff) | |
download | pdfium-bc29701214bf96bfacbef04b345bee76fd7bce84.tar.xz |
Make out_row_buffer an std::vector
The out_row_buffer of BMPDecompressor is made a vector. This forces the
class to have constructor/destructor. Some other members were changed
to be of size_t instead of int32_t.
Change-Id: I3f70b0322dcee2ddf9a00da7962b43f3415ba545
Reviewed-on: https://pdfium-review.googlesource.com/6691
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcodec/lbmp/fx_bmp.h')
-rw-r--r-- | core/fxcodec/lbmp/fx_bmp.h | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/core/fxcodec/lbmp/fx_bmp.h b/core/fxcodec/lbmp/fx_bmp.h index 2612d7eb8c..bf5e94fc23 100644 --- a/core/fxcodec/lbmp/fx_bmp.h +++ b/core/fxcodec/lbmp/fx_bmp.h @@ -8,6 +8,7 @@ #define CORE_FXCODEC_LBMP_FX_BMP_H_ #include <setjmp.h> +#include <vector> #include "core/fxcodec/codec/ccodec_bmpmodule.h" #include "core/fxcrt/fx_basic.h" @@ -68,6 +69,9 @@ typedef struct tagBmpInfoHeader { class BMPDecompressor { public: + BMPDecompressor(); + ~BMPDecompressor(); + void Error(const char* err_msg); int32_t DecodeImage(); int32_t ReadHeader(); @@ -81,24 +85,24 @@ class BMPDecompressor { BmpFileHeaderPtr bmp_header_ptr; BmpInfoHeaderPtr bmp_infoheader_ptr; - int32_t width; - int32_t height; + std::vector<uint8_t> out_row_buffer; + + uint32_t width; + uint32_t height; uint32_t compress_flag; int32_t components; - int32_t src_row_bytes; - int32_t out_row_bytes; - uint8_t* out_row_buffer; + size_t src_row_bytes; + size_t out_row_bytes; uint16_t bitCounts; uint32_t color_used; - bool imgTB_flag; int32_t pal_num; int32_t pal_type; uint32_t* pal_ptr; uint32_t data_size; uint32_t img_data_offset; uint32_t img_ifh_size; - int32_t row_num; - int32_t col_num; + size_t row_num; + size_t col_num; int32_t dpi_x; int32_t dpi_y; uint32_t mask_red; @@ -112,7 +116,7 @@ class BMPDecompressor { private: bool GetDataPosition(uint32_t cur_pos); - void ReadScanline(int32_t row_num, uint8_t* row_buf); + void ReadScanline(uint32_t row_num, const std::vector<uint8_t>& row_buf); int32_t DecodeRGB(); int32_t DecodeRLE8(); int32_t DecodeRLE4(); @@ -122,17 +126,12 @@ class BMPDecompressor { bool ValidateFlag() const; }; -BMPDecompressor* bmp_create_decompress(); -void bmp_destroy_decompress(BMPDecompressor** bmp_ptr_ptr); - class CBmpContext : public CCodec_BmpModule::Context { public: - CBmpContext(BMPDecompressor* pBmp, - CCodec_BmpModule* pModule, - CCodec_BmpModule::Delegate* pDelegate); + CBmpContext(CCodec_BmpModule* pModule, CCodec_BmpModule::Delegate* pDelegate); ~CBmpContext() override; - BMPDecompressor* m_pBmp; + BMPDecompressor m_Bmp; CFX_UnownedPtr<CCodec_BmpModule> const m_pModule; CFX_UnownedPtr<CCodec_BmpModule::Delegate> const m_pDelegate; char m_szLastError[256]; |