diff options
author | Ryan Harrison <rharrison@chromium.org> | 2018-02-06 16:55:14 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-02-06 16:55:14 +0000 |
commit | b5a2d14e21c0f149be49e06141549b185a5c7993 (patch) | |
tree | 7816907618e24262caf7f24bd2ec36d6dd9eaa7e /core/fxcodec/bmp/cfx_bmpdecompressor.h | |
parent | 41441c9da88210376a87c4d03d71232b390b7cee (diff) | |
download | pdfium-b5a2d14e21c0f149be49e06141549b185a5c7993.tar.xz |
Extract classes in fx_bmp.h into their own files
BUG=chromium:808336
Change-Id: I3201805a374b5403149eca701714ef4369a2e337
Reviewed-on: https://pdfium-review.googlesource.com/25630
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/bmp/cfx_bmpdecompressor.h')
-rw-r--r-- | core/fxcodec/bmp/cfx_bmpdecompressor.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.h b/core/fxcodec/bmp/cfx_bmpdecompressor.h new file mode 100644 index 0000000000..499d559637 --- /dev/null +++ b/core/fxcodec/bmp/cfx_bmpdecompressor.h @@ -0,0 +1,76 @@ +// Copyright 2018 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FXCODEC_BMP_CFX_BMPDECOMPRESSOR_H_ +#define CORE_FXCODEC_BMP_CFX_BMPDECOMPRESSOR_H_ + +#include "core/fxcodec/bmp/fx_bmp.h" + +#include <setjmp.h> + +#include <memory> +#include <vector> + +class CFX_BmpDecompressor { + public: + CFX_BmpDecompressor(); + ~CFX_BmpDecompressor(); + + void Error(); + int32_t DecodeImage(); + int32_t ReadHeader(); + void SetInputBuffer(uint8_t* src_buf, uint32_t src_size); + uint32_t GetAvailInput(uint8_t** avail_buf); + + jmp_buf jmpbuf_; + + void* context_ptr_; + + std::vector<uint8_t> out_row_buffer_; + std::vector<uint32_t> palette_; + uint8_t* next_in_; + + uint32_t header_offset_; + uint32_t width_; + uint32_t height_; + uint32_t compress_flag_; + int32_t components_; + size_t src_row_bytes_; + size_t out_row_bytes_; + uint16_t bit_counts_; + uint32_t color_used_; + bool imgTB_flag_; + int32_t pal_num_; + int32_t pal_type_; + uint32_t data_size_; + uint32_t img_data_offset_; + uint32_t img_ifh_size_; + size_t row_num_; + size_t col_num_; + int32_t dpi_x_; + int32_t dpi_y_; + uint32_t mask_red_; + uint32_t mask_green_; + uint32_t mask_blue_; + + uint32_t avail_in_; + uint32_t skip_size_; + int32_t decode_status_; + + private: + bool GetDataPosition(uint32_t cur_pos); + void ReadScanline(uint32_t row_num, const std::vector<uint8_t>& row_buf); + int32_t DecodeRGB(); + int32_t DecodeRLE8(); + int32_t DecodeRLE4(); + uint8_t* ReadData(uint8_t** des_buf, uint32_t data_size); + void SaveDecodingStatus(int32_t status); + bool ValidateColorIndex(uint8_t val); + bool ValidateFlag() const; + void SetHeight(int32_t signed_height); +}; + +#endif // CORE_FXCODEC_BMP_CFX_BMPDECOMPRESSOR_H_ |