summaryrefslogtreecommitdiff
path: root/core/fxcodec/lgif/fx_gif.h
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-26 15:39:10 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-26 19:58:33 +0000
commite2df5b7305df66efbd81232d911615af60624ae3 (patch)
tree5c5aff0ae260792790cfb1ed2f3f15863c0c0d63 /core/fxcodec/lgif/fx_gif.h
parent7d04f1b0ab4848f1d10983b7a7b1444ac93dec70 (diff)
downloadpdfium-e2df5b7305df66efbd81232d911615af60624ae3.tar.xz
Move LZW decoder out of fx_gif
CGifLZWDecoder has been moved out into its own file, name changed to CFX_LZWDecoder, member variable names updated, creation pattern changed, and unit tests added. Wrt the creation pattern, there is no longer a constructor and 2 initialization methods that need to be called. Instead all of the initialization is done as part of the constructor. A wrapper has been added for generating a std::unique_ptr<CFX_LZWDecoder>, so that params can be validated. BUG=pdfium:900,pdfium:901,pdfium:903,pdfium:904 Change-Id: Idcbe773f7fb18b08e64d5a89bfd87d4801332c53 Reviewed-on: https://pdfium-review.googlesource.com/14814 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/lgif/fx_gif.h')
-rw-r--r--core/fxcodec/lgif/fx_gif.h51
1 files changed, 10 insertions, 41 deletions
diff --git a/core/fxcodec/lgif/fx_gif.h b/core/fxcodec/lgif/fx_gif.h
index c3ddf36e3b..bbf847de39 100644
--- a/core/fxcodec/lgif/fx_gif.h
+++ b/core/fxcodec/lgif/fx_gif.h
@@ -35,6 +35,7 @@ class CGifContext;
#define GIF_D_STATUS_EXT_UNE 0x08
#define GIF_D_STATUS_IMG_INFO 0x09
#define GIF_D_STATUS_IMG_DATA 0x0A
+
#pragma pack(1)
typedef struct tagGifGF {
uint8_t pal_bits : 3;
@@ -42,6 +43,7 @@ typedef struct tagGifGF {
uint8_t color_resolution : 3;
uint8_t global_pal : 1;
} GifGF;
+
typedef struct tagGifLF {
uint8_t pal_bits : 3;
uint8_t reserved : 2;
@@ -49,10 +51,12 @@ typedef struct tagGifLF {
uint8_t interlace : 1;
uint8_t local_pal : 1;
} GifLF;
+
typedef struct tagGifHeader {
char signature[3];
char version[3];
} GifHeader;
+
typedef struct tagGifLSD {
uint16_t width;
uint16_t height;
@@ -60,6 +64,7 @@ typedef struct tagGifLSD {
uint8_t bc_index;
uint8_t pixel_aspect;
} GifLSD;
+
typedef struct tagGifImageInfo {
uint16_t left;
uint16_t top;
@@ -68,18 +73,21 @@ typedef struct tagGifImageInfo {
uint8_t local_flag;
} GifImageInfo;
+
typedef struct tagGifCEF {
uint8_t transparency : 1;
uint8_t user_input : 1;
uint8_t disposal_method : 3;
uint8_t reserved : 3;
} GifCEF;
+
typedef struct tagGifGCE {
uint8_t block_size;
uint8_t gce_flag;
uint16_t delay_time;
uint8_t trans_index;
} GifGCE;
+
typedef struct tagGifPTE {
uint8_t block_size;
uint16_t grid_left;
@@ -93,11 +101,13 @@ typedef struct tagGifPTE {
uint8_t fc_index;
uint8_t bc_index;
} GifPTE;
+
typedef struct tagGifAE {
uint8_t block_size;
uint8_t app_identify[8];
uint8_t app_authentication[3];
} GifAE;
+
typedef struct tagGifPalette { uint8_t r, g, b; } GifPalette;
#pragma pack()
@@ -123,45 +133,4 @@ class GifImage {
int32_t image_row_num;
};
-class CGifLZWDecoder {
- public:
- struct tag_Table {
- uint16_t prefix;
- uint8_t suffix;
- };
-
- explicit CGifLZWDecoder(char* error_ptr);
- ~CGifLZWDecoder();
-
- void InitTable(uint8_t color_exp, uint8_t code_exp);
- GifDecodeStatus Decode(uint8_t* des_buf, uint32_t* des_size);
- void Input(uint8_t* src_buf, uint32_t src_size);
- uint32_t GetAvailInput();
-
- private:
- void ClearTable();
- void AddCode(uint16_t prefix_code, uint8_t append_char);
- bool DecodeString(uint16_t code);
-
- uint8_t code_size;
- uint8_t code_size_cur;
- uint16_t code_color_end;
- uint16_t code_clear;
- uint16_t code_end;
- uint16_t code_next;
- uint8_t code_first;
- uint8_t stack[GIF_MAX_LZW_CODE];
- uint16_t stack_size;
- tag_Table code_table[GIF_MAX_LZW_CODE];
- uint16_t code_old;
-
- uint8_t* next_in;
- uint32_t avail_in;
-
- uint8_t bits_left;
- uint32_t code_store;
-
- char* err_msg_ptr;
-};
-
#endif // CORE_FXCODEC_LGIF_FX_GIF_H_