summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-05-08 16:26:31 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2022-05-08 16:26:31 +0100
commitc52794486f394b52a5216ccbcca3fd0604cdca9d (patch)
tree68ee9ef62c031f0a6f0643e3544702828c524c68
parent0e1ce8d71d6606640199e914b2c63482f044639c (diff)
downloadlibnsgif-c52794486f394b52a5216ccbcca3fd0604cdca9d.tar.gz
API: Replace colour_table with {global|local}_palette.
Avoiding use of "colour" because of different spelling in US.
-rw-r--r--include/nsgif.h4
-rw-r--r--src/gif.c12
-rw-r--r--test/nsgif.c7
3 files changed, 11 insertions, 12 deletions
diff --git a/include/nsgif.h b/include/nsgif.h
index 2251060..208bc27 100644
--- a/include/nsgif.h
+++ b/include/nsgif.h
@@ -364,7 +364,7 @@ typedef struct nsgif_info {
/** background colour in same pixel format as \ref nsgif_bitmap_t. */
uint32_t background;
/** whether the GIF has a global colour table */
- bool colour_table;
+ bool global_palette;
} nsgif_info_t;
/**
@@ -398,7 +398,7 @@ typedef struct nsgif_frame_info {
/** whether the frame may have transparency */
bool transparency;
/** whether the frame has a local colour table */
- bool colour_table;
+ bool local_palette;
/** Disposal method for previous frame; affects plotting */
uint8_t disposal;
diff --git a/src/gif.c b/src/gif.c
index 7f1d4c8..d2b6054 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -1149,7 +1149,7 @@ static nsgif_error nsgif__parse_colour_table(
if (decode) {
gif->colour_table = gif->local_colour_table;
} else {
- frame->info.colour_table = true;
+ frame->info.local_palette = true;
}
return NSGIF_OK;
@@ -1260,7 +1260,7 @@ static struct nsgif_frame *nsgif__get_frame(
frame->transparency_index = NSGIF_NO_TRANSPARENCY;
frame->frame_offset = gif->buf_pos;
- frame->info.colour_table = false;
+ frame->info.local_palette = false;
frame->info.transparency = false;
frame->redraw_required = false;
frame->info.display = false;
@@ -1573,7 +1573,7 @@ static nsgif_error nsgif__parse_logical_screen_descriptor(
gif->info.width = data[0] | (data[1] << 8);
gif->info.height = data[2] | (data[3] << 8);
- gif->info.colour_table = data[4] & NSGIF_COLOUR_TABLE_MASK;
+ gif->info.global_palette = data[4] & NSGIF_COLOUR_TABLE_MASK;
gif->colour_table_size = 2 << (data[4] & NSGIF_COLOUR_TABLE_SIZE_MASK);
gif->bg_index = data[5];
gif->aspect_ratio = data[6];
@@ -1667,7 +1667,7 @@ nsgif_error nsgif_data_scan(
*/
if (gif->global_colour_table[0] == NSGIF_PROCESS_COLOURS) {
/* Check for a global colour map signified by bit 7 */
- if (gif->info.colour_table) {
+ if (gif->info.global_palette) {
size_t remaining = gif->buf + gif->buf_len - nsgif_data;
size_t used;
@@ -1704,7 +1704,7 @@ nsgif_error nsgif_data_scan(
gif->colour_table_size = 2;
}
- if (gif->info.colour_table &&
+ if (gif->info.global_palette &&
gif->bg_index < gif->colour_table_size) {
size_t bg_idx = gif->bg_index;
gif->info.background = gif->global_colour_table[bg_idx];
@@ -1964,7 +1964,7 @@ bool nsgif_local_palette(
}
f = &gif->frames[frame];
- if (f->info.colour_table == false) {
+ if (f->info.local_palette == false) {
return false;
}
diff --git a/test/nsgif.c b/test/nsgif.c
index 7f1cc55..aa66706 100644
--- a/test/nsgif.c
+++ b/test/nsgif.c
@@ -150,8 +150,7 @@ static void print_gif_info(const nsgif_info_t *info)
fprintf(stdout, " height: %"PRIu32"\n", info->height);
fprintf(stdout, " max-loops: %"PRIu32"\n", info->loop_max);
fprintf(stdout, " frame-count: %"PRIu32"\n", info->frame_count);
- fprintf(stdout, " global colour table: %s\n",
- info->colour_table ? "yes" : "no");
+ fprintf(stdout, " global palette: %s\n", info->global_palette ? "yes" : "no");
fprintf(stdout, " background:\n");
fprintf(stdout, " red: 0x%"PRIx8"\n", bg[0]);
fprintf(stdout, " green: 0x%"PRIx8"\n", bg[1]);
@@ -164,7 +163,7 @@ static void print_gif_frame_info(const nsgif_frame_info_t *info, uint32_t i)
const char *disposal = nsgif_str_disposal(info->disposal);
fprintf(stdout, " - frame: %"PRIu32"\n", i);
- fprintf(stdout, " local colour table: %s\n", info->colour_table ? "yes" : "no");
+ fprintf(stdout, " local palette: %s\n", info->local_palette ? "yes" : "no");
fprintf(stdout, " disposal-method: %s\n", disposal);
fprintf(stdout, " transparency: %s\n", info->transparency ? "yes" : "no");
fprintf(stdout, " display: %s\n", info->display ? "yes" : "no");
@@ -273,7 +272,7 @@ static void decode(FILE* ppm, const char *name, nsgif_t *gif)
if (nsgif_options.info == true) {
print_gif_info(info);
}
- if (nsgif_options.palette == true && info->colour_table == true) {
+ if (nsgif_options.palette == true && info->global_palette == true) {
save_global_palette(gif);
}