Skip to content

Commit

Permalink
Update style and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
aaaaaa123456789 committed Jan 19, 2022
1 parent ae04c28 commit 4636d66
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Note: releases are listed from latest to oldest.

## Version 1.0 (in development)

- Fixed a bug when loading APNG files with reduced frames
- Ensured that the `PLUM_FILENAME`, `PLUM_BUFFER` and `PLUM_CALLBACK` constants are always `size_t` as documented
- Enforced the size limitation on the value returned by a callback when using the `PLUM_CALLBACK` loading/storing mode
- Added some warning flags for debug builds, and cleared some warnings that would be raised by them
Expand Down
4 changes: 2 additions & 2 deletions src/pngread.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void load_PNG_data (struct context * context, unsigned flags, size_t limit) {
}
add_PNG_bit_depth_metadata(context, chunks, imagetype, bitdepth);
uint64_t background = add_PNG_background_metadata(context, chunks, palette, imagetype, bitdepth, max_palette_index, flags);
uint64_t transparent = -(uint64_t) 1;
uint64_t transparent = 0xffffffffffffffffu;
if (chunks -> transparency)
if (imagetype <= 2)
transparent = load_PNG_transparent_color(context, chunks -> transparency, imagetype, bitdepth);
Expand Down Expand Up @@ -104,7 +104,7 @@ void load_PNG_data (struct context * context, unsigned flags, size_t limit) {
*(current ++) = background | 0xffff000000000000u;
else {
*current = pixels[index ++];
if ((transparent != -(uint64_t) 1) && (*current == transparent)) *current = background | 0xffff000000000000u;
if ((transparent != 0xffffffffffffffffu) && (*current == transparent)) *current = background | 0xffff000000000000u;
current ++;
}
ctxfree(context, pixels);
Expand Down
2 changes: 1 addition & 1 deletion src/pngreadframe.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ void load_PNG_frame (struct context * context, const size_t * chunks, uint32_t f
if (palette)
write_palette_framebuffer_to_image(context, data, palette, frame, context -> image -> color_format, 0xff); // 0xff to avoid a redundant range check
else {
if (transparent != -(uint64_t) 1) {
if (transparent != 0xffffffffffffffffu) {
uint64_t * current = data;
size_t count = (size_t) context -> image -> width * context -> image -> height;
for (; count; count --, current ++) if (*current == transparent) *current = background | 0xffff000000000000u;
Expand Down

0 comments on commit 4636d66

Please sign in to comment.