diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-05-18 10:31:15 +1000 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-05-18 10:31:42 +1000 |
| commit | cbd6c45887a177bd9279ce9198da0712a6417248 (patch) | |
| tree | 4a9a12ed4ad2ec4bcee19fc14ae9e2e5f19ea30a /src | |
| parent | 57cd3d1fee606fd27992d3ad6be819ffbb0af001 (diff) | |
ci(coverage): Add repo coverage with codecov
Diffstat (limited to 'src')
| -rw-r--r-- | src/format/image/png.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/format/image/png.c b/src/format/image/png.c index 3b1fe5c..32399c6 100644 --- a/src/format/image/png.c +++ b/src/format/image/png.c @@ -440,19 +440,19 @@ ff_result ff_png_end_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx * ff_result ff_png_trans_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx *png_ctx) { - (void)buf; // Unused (for now) - - ff_dprintf(ctx, "png: tRNS chunk received\n"); // TODO: Format + ff_dprintf(ctx, "png: tRNS chunk received\n"); - if (png_ctx->color_type == 0) { // Grayscale - if (len != 2) { - ff_dprintf(ctx, "png: invalid tRNS length for grayscale image\n"); - png_ctx->last_error = FF_RESULT_ERROR_INVALID_FILE; - return FF_RESULT_ERROR_INVALID_FILE; + if (png_ctx->color_type == 3) { // indexed + size_t count = len; + if (count > png_ctx->palette_size) + count = png_ctx->palette_size; + + for (size_t i = 0; i < count; i++) { + png_ctx->palette[i * 4 + 3] = buf[i]; } } - return FF_RESULT_WARN_NO_IMPL; + return FF_RESULT_OK; } |
