| 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_FXCODEC_LBMP_FX_BMP_H_ | 7 #ifndef CORE_FXCODEC_LBMP_FX_BMP_H_ |
| 8 #define CORE_FXCODEC_LBMP_FX_BMP_H_ | 8 #define CORE_FXCODEC_LBMP_FX_BMP_H_ |
| 9 | 9 |
| 10 #include <setjmp.h> | 10 #include <setjmp.h> |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #define RLE_DELTA 2 | 28 #define RLE_DELTA 2 |
| 29 #define BMP_RGB 0L | 29 #define BMP_RGB 0L |
| 30 #define BMP_RLE8 1L | 30 #define BMP_RLE8 1L |
| 31 #define BMP_RLE4 2L | 31 #define BMP_RLE4 2L |
| 32 #define BMP_BITFIELDS 3L | 32 #define BMP_BITFIELDS 3L |
| 33 #define BMP_BIT_555 0 | 33 #define BMP_BIT_555 0 |
| 34 #define BMP_BIT_565 1 | 34 #define BMP_BIT_565 1 |
| 35 #define BMP_MAX_ERROR_SIZE 256 | 35 #define BMP_MAX_ERROR_SIZE 256 |
| 36 #pragma pack(1) | 36 #pragma pack(1) |
| 37 typedef struct tagBmpFileHeader { | 37 typedef struct tagBmpFileHeader { |
| 38 FX_WORD bfType; | 38 uint16_t bfType; |
| 39 FX_DWORD bfSize; | 39 FX_DWORD bfSize; |
| 40 FX_WORD bfReserved1; | 40 uint16_t bfReserved1; |
| 41 FX_WORD bfReserved2; | 41 uint16_t bfReserved2; |
| 42 FX_DWORD bfOffBits; | 42 FX_DWORD bfOffBits; |
| 43 } BmpFileHeader, *BmpFileHeaderPtr; | 43 } BmpFileHeader, *BmpFileHeaderPtr; |
| 44 typedef struct tagBmpCoreHeader { | 44 typedef struct tagBmpCoreHeader { |
| 45 FX_DWORD bcSize; | 45 FX_DWORD bcSize; |
| 46 FX_WORD bcWidth; | 46 uint16_t bcWidth; |
| 47 FX_WORD bcHeight; | 47 uint16_t bcHeight; |
| 48 FX_WORD bcPlanes; | 48 uint16_t bcPlanes; |
| 49 FX_WORD bcBitCount; | 49 uint16_t bcBitCount; |
| 50 } BmpCoreHeader, *BmpCoreHeaderPtr; | 50 } BmpCoreHeader, *BmpCoreHeaderPtr; |
| 51 typedef struct tagBmpInfoHeader { | 51 typedef struct tagBmpInfoHeader { |
| 52 FX_DWORD biSize; | 52 FX_DWORD biSize; |
| 53 int32_t biWidth; | 53 int32_t biWidth; |
| 54 int32_t biHeight; | 54 int32_t biHeight; |
| 55 FX_WORD biPlanes; | 55 uint16_t biPlanes; |
| 56 FX_WORD biBitCount; | 56 uint16_t biBitCount; |
| 57 FX_DWORD biCompression; | 57 FX_DWORD biCompression; |
| 58 FX_DWORD biSizeImage; | 58 FX_DWORD biSizeImage; |
| 59 int32_t biXPelsPerMeter; | 59 int32_t biXPelsPerMeter; |
| 60 int32_t biYPelsPerMeter; | 60 int32_t biYPelsPerMeter; |
| 61 FX_DWORD biClrUsed; | 61 FX_DWORD biClrUsed; |
| 62 FX_DWORD biClrImportant; | 62 FX_DWORD biClrImportant; |
| 63 } BmpInfoHeader, *BmpInfoHeaderPtr; | 63 } BmpInfoHeader, *BmpInfoHeaderPtr; |
| 64 #pragma pack() | 64 #pragma pack() |
| 65 | 65 |
| 66 typedef struct tag_bmp_decompress_struct bmp_decompress_struct; | 66 typedef struct tag_bmp_decompress_struct bmp_decompress_struct; |
| 67 typedef bmp_decompress_struct* bmp_decompress_struct_p; | 67 typedef bmp_decompress_struct* bmp_decompress_struct_p; |
| 68 typedef bmp_decompress_struct_p* bmp_decompress_struct_pp; | 68 typedef bmp_decompress_struct_p* bmp_decompress_struct_pp; |
| 69 struct tag_bmp_decompress_struct { | 69 struct tag_bmp_decompress_struct { |
| 70 jmp_buf jmpbuf; | 70 jmp_buf jmpbuf; |
| 71 FX_CHAR* err_ptr; | 71 FX_CHAR* err_ptr; |
| 72 void (*bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); | 72 void (*bmp_error_fn)(bmp_decompress_struct_p gif_ptr, const FX_CHAR* err_msg); |
| 73 | 73 |
| 74 void* context_ptr; | 74 void* context_ptr; |
| 75 | 75 |
| 76 BmpFileHeaderPtr bmp_header_ptr; | 76 BmpFileHeaderPtr bmp_header_ptr; |
| 77 BmpInfoHeaderPtr bmp_infoheader_ptr; | 77 BmpInfoHeaderPtr bmp_infoheader_ptr; |
| 78 int32_t width; | 78 int32_t width; |
| 79 int32_t height; | 79 int32_t height; |
| 80 FX_DWORD compress_flag; | 80 FX_DWORD compress_flag; |
| 81 int32_t components; | 81 int32_t components; |
| 82 int32_t src_row_bytes; | 82 int32_t src_row_bytes; |
| 83 int32_t out_row_bytes; | 83 int32_t out_row_bytes; |
| 84 uint8_t* out_row_buffer; | 84 uint8_t* out_row_buffer; |
| 85 FX_WORD bitCounts; | 85 uint16_t bitCounts; |
| 86 FX_DWORD color_used; | 86 FX_DWORD color_used; |
| 87 FX_BOOL imgTB_flag; | 87 FX_BOOL imgTB_flag; |
| 88 int32_t pal_num; | 88 int32_t pal_num; |
| 89 int32_t pal_type; | 89 int32_t pal_type; |
| 90 FX_DWORD* pal_ptr; | 90 FX_DWORD* pal_ptr; |
| 91 FX_DWORD data_size; | 91 FX_DWORD data_size; |
| 92 FX_DWORD img_data_offset; | 92 FX_DWORD img_data_offset; |
| 93 FX_DWORD img_ifh_size; | 93 FX_DWORD img_ifh_size; |
| 94 int32_t row_num; | 94 int32_t row_num; |
| 95 int32_t col_num; | 95 int32_t col_num; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 struct tag_bmp_compress_struct { | 132 struct tag_bmp_compress_struct { |
| 133 BmpFileHeader file_header; | 133 BmpFileHeader file_header; |
| 134 BmpInfoHeader info_header; | 134 BmpInfoHeader info_header; |
| 135 uint8_t* src_buf; | 135 uint8_t* src_buf; |
| 136 FX_DWORD src_pitch; | 136 FX_DWORD src_pitch; |
| 137 FX_DWORD src_row; | 137 FX_DWORD src_row; |
| 138 uint8_t src_bpp; | 138 uint8_t src_bpp; |
| 139 FX_DWORD src_width; | 139 FX_DWORD src_width; |
| 140 FX_BOOL src_free; | 140 FX_BOOL src_free; |
| 141 FX_DWORD* pal_ptr; | 141 FX_DWORD* pal_ptr; |
| 142 FX_WORD pal_num; | 142 uint16_t pal_num; |
| 143 uint8_t bit_type; | 143 uint8_t bit_type; |
| 144 }; | 144 }; |
| 145 | 145 |
| 146 bmp_compress_struct_p bmp_create_compress(); | 146 bmp_compress_struct_p bmp_create_compress(); |
| 147 void bmp_destroy_compress(bmp_compress_struct_p bmp_ptr); | 147 void bmp_destroy_compress(bmp_compress_struct_p bmp_ptr); |
| 148 FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr, | 148 FX_BOOL bmp_encode_image(bmp_compress_struct_p bmp_ptr, |
| 149 uint8_t*& dst_buf, | 149 uint8_t*& dst_buf, |
| 150 FX_DWORD& dst_size); | 150 FX_DWORD& dst_size); |
| 151 | 151 |
| 152 FX_WORD GetWord_LSBFirst(uint8_t* p); | 152 uint16_t GetWord_LSBFirst(uint8_t* p); |
| 153 void SetWord_LSBFirst(uint8_t* p, FX_WORD v); | 153 void SetWord_LSBFirst(uint8_t* p, uint16_t v); |
| 154 | 154 |
| 155 #endif // CORE_FXCODEC_LBMP_FX_BMP_H_ | 155 #endif // CORE_FXCODEC_LBMP_FX_BMP_H_ |
| OLD | NEW |