| 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_LBMP_FX_BMP_H_ | 7 #ifndef CORE_SRC_FXCODEC_LBMP_FX_BMP_H_ |
| 8 #define CORE_SRC_FXCODEC_LBMP_FX_BMP_H_ | 8 #define CORE_SRC_FXCODEC_LBMP_FX_BMP_H_ |
| 9 | 9 |
| 10 #include <setjmp.h> | 10 #include <setjmp.h> |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 FX_DWORD biClrImportant; | 63 FX_DWORD biClrImportant; |
| 64 } BmpInfoHeader, *BmpInfoHeaderPtr; | 64 } BmpInfoHeader, *BmpInfoHeaderPtr; |
| 65 #pragma pack() | 65 #pragma pack() |
| 66 | 66 |
| 67 typedef struct tag_bmp_decompress_struct bmp_decompress_struct; | 67 typedef struct tag_bmp_decompress_struct bmp_decompress_struct; |
| 68 typedef bmp_decompress_struct* bmp_decompress_struct_p; | 68 typedef bmp_decompress_struct* bmp_decompress_struct_p; |
| 69 typedef bmp_decompress_struct_p* bmp_decompress_struct_pp; | 69 typedef bmp_decompress_struct_p* bmp_decompress_struct_pp; |
| 70 struct tag_bmp_decompress_struct { | 70 struct tag_bmp_decompress_struct { |
| 71 jmp_buf jmpbuf; | 71 jmp_buf jmpbuf; |
| 72 FX_CHAR* err_ptr; | 72 FX_CHAR* err_ptr; |
| 73 void (*_bmp_error_fn)(bmp_decompress_struct_p gif_ptr, | 73 void (*bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); |
| 74 const FX_CHAR* err_msg); | |
| 75 | 74 |
| 76 void* context_ptr; | 75 void* context_ptr; |
| 77 | 76 |
| 78 BmpFileHeaderPtr bmp_header_ptr; | 77 BmpFileHeaderPtr bmp_header_ptr; |
| 79 BmpInfoHeaderPtr bmp_infoheader_ptr; | 78 BmpInfoHeaderPtr bmp_infoheader_ptr; |
| 80 int32_t width; | 79 int32_t width; |
| 81 int32_t height; | 80 int32_t height; |
| 82 FX_DWORD compress_flag; | 81 FX_DWORD compress_flag; |
| 83 int32_t components; | 82 int32_t components; |
| 84 int32_t src_row_bytes; | 83 int32_t src_row_bytes; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 96 int32_t row_num; | 95 int32_t row_num; |
| 97 int32_t col_num; | 96 int32_t col_num; |
| 98 int32_t dpi_x; | 97 int32_t dpi_x; |
| 99 int32_t dpi_y; | 98 int32_t dpi_y; |
| 100 #ifdef BMP_SUPPORT_BITFIELD | 99 #ifdef BMP_SUPPORT_BITFIELD |
| 101 FX_DWORD mask_red; | 100 FX_DWORD mask_red; |
| 102 FX_DWORD mask_green; | 101 FX_DWORD mask_green; |
| 103 FX_DWORD mask_blue; | 102 FX_DWORD mask_blue; |
| 104 #endif | 103 #endif |
| 105 | 104 |
| 106 FX_BOOL (*_bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr, | 105 FX_BOOL (*bmp_get_data_position_fn)(bmp_decompress_struct_p bmp_ptr, |
| 107 FX_DWORD cur_pos); | 106 FX_DWORD cur_pos); |
| 108 void (*_bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, | 107 void (*bmp_get_row_fn)(bmp_decompress_struct_p bmp_ptr, |
| 109 int32_t row_num, | 108 int32_t row_num, |
| 110 uint8_t* row_buf); | 109 uint8_t* row_buf); |
| 111 uint8_t* next_in; | 110 uint8_t* next_in; |
| 112 FX_DWORD avail_in; | 111 FX_DWORD avail_in; |
| 113 FX_DWORD skip_size; | 112 FX_DWORD skip_size; |
| 114 int32_t decode_status; | 113 int32_t decode_status; |
| 115 }; | 114 }; |
| 116 void _bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg); | 115 void bmp_error(bmp_decompress_struct_p bmp_ptr, const FX_CHAR* err_msg); |
| 117 bmp_decompress_struct_p _bmp_create_decompress(); | 116 bmp_decompress_struct_p bmp_create_decompress(); |
| 118 void _bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr); | 117 void bmp_destroy_decompress(bmp_decompress_struct_pp bmp_ptr_ptr); |
| 119 int32_t _bmp_read_header(bmp_decompress_struct_p bmp_ptr); | 118 int32_t bmp_read_header(bmp_decompress_struct_p bmp_ptr); |
| 120 int32_t _bmp_decode_image(bmp_decompress_struct_p bmp_ptr); | 119 int32_t bmp_decode_image(bmp_decompress_struct_p bmp_ptr); |
| 121 int32_t _bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr); | 120 int32_t bmp_decode_rgb(bmp_decompress_struct_p bmp_ptr); |
| 122 int32_t _bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr); | 121 int32_t bmp_decode_rle8(bmp_decompress_struct_p bmp_ptr); |
| 123 int32_t _bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr); | 122 int32_t bmp_decode_rle4(bmp_decompress_struct_p bmp_ptr); |
| 124 uint8_t* _bmp_read_data(bmp_decompress_struct_p bmp_ptr, | 123 uint8_t* bmp_read_data(bmp_decompress_struct_p bmp_ptr, |
| 125 uint8_t** des_buf_pp, | 124 uint8_t** des_buf_pp, |
| 126 FX_DWORD data_size); | 125 FX_DWORD data_size); |
| 127 void _bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status); | 126 void bmp_save_decoding_status(bmp_decompress_struct_p bmp_ptr, int32_t status); |
| 128 void _bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, | 127 void bmp_input_buffer(bmp_decompress_struct_p bmp_ptr, |
| 129 uint8_t* src_buf, | 128 uint8_t* src_buf, |
| 130 FX_DWORD src_size); | 129 FX_DWORD src_size); |
| 131 FX_DWORD _bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, | 130 FX_DWORD bmp_get_avail_input(bmp_decompress_struct_p bmp_ptr, |
| 132 uint8_t** avial_buf_ptr); | 131 uint8_t** avial_buf_ptr); |
| 133 typedef struct tag_bmp_compress_struct bmp_compress_struct; | 132 typedef struct tag_bmp_compress_struct bmp_compress_struct; |
| 134 typedef bmp_compress_struct* bmp_compress_struct_p; | 133 typedef bmp_compress_struct* bmp_compress_struct_p; |
| 135 typedef bmp_compress_struct_p* bmp_compress_struct_pp; | 134 typedef bmp_compress_struct_p* bmp_compress_struct_pp; |
| 136 struct tag_bmp_compress_struct { | 135 struct tag_bmp_compress_struct { |
| 137 BmpFileHeader file_header; | 136 BmpFileHeader file_header; |
| 138 BmpInfoHeader info_header; | 137 BmpInfoHeader info_header; |
| 139 uint8_t* src_buf; | 138 uint8_t* src_buf; |
| 140 FX_DWORD src_pitch; | 139 FX_DWORD src_pitch; |
| 141 FX_DWORD src_row; | 140 FX_DWORD src_row; |
| 142 uint8_t src_bpp; | 141 uint8_t src_bpp; |
| 143 FX_DWORD src_width; | 142 FX_DWORD src_width; |
| 144 FX_BOOL src_free; | 143 FX_BOOL src_free; |
| 145 FX_DWORD* pal_ptr; | 144 FX_DWORD* pal_ptr; |
| 146 FX_WORD pal_num; | 145 FX_WORD pal_num; |
| 147 #ifdef BMP_SUPPORT_BITFIELD | 146 #ifdef BMP_SUPPORT_BITFIELD |
| 148 uint8_t bit_type; | 147 uint8_t bit_type; |
| 149 #endif | 148 #endif |
| 150 }; | 149 }; |
| 151 | 150 |
| 152 bmp_compress_struct_p _bmp_create_compress(); | 151 bmp_compress_struct_p bmp_create_compress(); |
| 153 void _bmp_destroy_compress(bmp_compress_struct_p bmp_ptr); | 152 void bmp_destroy_compress(bmp_compress_struct_p bmp_ptr); |
| 154 FX_BOOL _bmp_encode_image(bmp_compress_struct_p bmp_ptr, | 153 FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr, |
| 155 uint8_t*& dst_buf, | 154 uint8_t*& dst_buf, |
| 156 FX_DWORD& dst_size); | 155 FX_DWORD& dst_size); |
| 156 |
| 157 FX_WORD GetWord_LSBFirst(uint8_t* p); |
| 158 void SetWord_LSBFirst(uint8_t* p, FX_WORD v); |
| 157 | 159 |
| 158 #endif // CORE_SRC_FXCODEC_LBMP_FX_BMP_H_ | 160 #endif // CORE_SRC_FXCODEC_LBMP_FX_BMP_H_ |
| OLD | NEW |