Skip to content

Commit

Permalink
PCX: Ignore redundant PaletteInfo header field (closes #210)
Browse files Browse the repository at this point in the history
  • Loading branch information
HappySeaFox committed May 12, 2024
1 parent 14ed67e commit f3f8291
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/sail-codecs/pcx/helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ sail_status_t pcx_private_read_header(struct sail_io *io, struct SailPcxHeader *
return SAIL_OK;
}

sail_status_t pcx_private_sail_pixel_format(unsigned bits_per_plane, unsigned planes, enum SailPcxPaletteInfo palette_info, enum SailPixelFormat *result) {
sail_status_t pcx_private_sail_pixel_format(unsigned bits_per_plane, unsigned planes, enum SailPixelFormat *result) {

switch (planes) {
case 1: {
switch (bits_per_plane) {
case 1: *result = SAIL_PIXEL_FORMAT_BPP1_INDEXED; return SAIL_OK;
case 4: *result = SAIL_PIXEL_FORMAT_BPP4_INDEXED; return SAIL_OK;
case 8: *result = (palette_info == SAIL_PCX_PALETTE_COLOR) ? SAIL_PIXEL_FORMAT_BPP8_INDEXED : SAIL_PIXEL_FORMAT_BPP8_GRAYSCALE; return SAIL_OK;
case 8: *result = SAIL_PIXEL_FORMAT_BPP8_INDEXED; return SAIL_OK;
}
break;
}
Expand Down
8 changes: 1 addition & 7 deletions src/sail-codecs/pcx/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,6 @@ enum SailPcxEncoding
SAIL_PCX_RLE_ENCODING = 1,
};

enum SailPcxPaletteInfo
{
SAIL_PCX_PALETTE_COLOR = 1,
SAIL_PCX_PALETTE_GRAYSCALE = 2,
};

struct SailPcxHeader
{
uint8_t id;
Expand All @@ -77,7 +71,7 @@ struct SailPcxHeader

SAIL_HIDDEN sail_status_t pcx_private_read_header(struct sail_io *io, struct SailPcxHeader *header);

SAIL_HIDDEN sail_status_t pcx_private_sail_pixel_format(unsigned bits_per_plane, unsigned planes, enum SailPcxPaletteInfo palette_info, enum SailPixelFormat *result);
SAIL_HIDDEN sail_status_t pcx_private_sail_pixel_format(unsigned bits_per_plane, unsigned planes, enum SailPixelFormat *result);

SAIL_HIDDEN sail_status_t pcx_private_build_palette(enum SailPixelFormat pixel_format, struct sail_io *io, uint8_t palette16[48], struct sail_palette **palette);

Expand Down
1 change: 0 additions & 1 deletion src/sail-codecs/pcx/pcx.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ SAIL_EXPORT sail_status_t sail_codec_load_seek_next_frame_v8_pcx(void *state, st
SAIL_TRY(pcx_private_sail_pixel_format(
pcx_state->pcx_header.bits_per_plane,
pcx_state->pcx_header.planes,
pcx_state->pcx_header.palette_info,
&pixel_format));

struct sail_image *image_local;
Expand Down

0 comments on commit f3f8291

Please sign in to comment.