diff options
| author | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-30 08:44:47 +1100 |
|---|---|---|
| committer | TazyFoundSoup <gardendistrict0x0@outlook.com> | 2026-03-30 08:44:47 +1100 |
| commit | 6c322787e99887dc8844aa6b8f7408eabeccd274 (patch) | |
| tree | e03b9abe5d724e4b39c10b193ed6f9ca0fce3033 /include/tinyff/image | |
| parent | 081889cfca1d984196fabdd6cf645f9f6a9890fb (diff) | |
feat(png): Require context for debug configuration
Diffstat (limited to 'include/tinyff/image')
| -rw-r--r-- | include/tinyff/image/png.h | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/include/tinyff/image/png.h b/include/tinyff/image/png.h index c4970f3..e011817 100644 --- a/include/tinyff/image/png.h +++ b/include/tinyff/image/png.h @@ -61,7 +61,7 @@ typedef struct { static inline uint16_t ff_png_bpp(ff_png_ctx *ctx); -typedef ff_result (*ff_png_chunk_handler_ptr)(uint8_t *buf, size_t len, ff_png_ctx* ctx); +typedef ff_result (*ff_png_chunk_handler_ptr)(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx* png_ctx); typedef struct { const char *type; @@ -72,33 +72,21 @@ typedef struct { // Massive W.I.P // Required by definition -ff_result ff_png_header_handler(uint8_t *buf, size_t len, ff_png_ctx* ctx); // IHDR -ff_result ff_png_palette_handler(uint8_t *buf, size_t len, ff_png_ctx* ctx); // PLTE -ff_result ff_png_data_handler(uint8_t *buf, size_t len, ff_png_ctx* ctx); // IDAT -ff_result ff_png_end_handler(uint8_t *buf, size_t len, ff_png_ctx* ctx); // IEND +ff_result ff_png_header_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx* png_ctx); // IHDR +ff_result ff_png_palette_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx* png_ctx); // PLTE +ff_result ff_png_data_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx* png_ctx); // IDAT +ff_result ff_png_end_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx* png_ctx); // IEND // Ancillary chunks -ff_result ff_png_trans_handler(uint8_t *buf, size_t len, ff_png_ctx* ctx); // tRNS +ff_result ff_png_trans_handler(ff_ctx* ctx, uint8_t *buf, size_t len, ff_png_ctx* png_ctx); // tRNS -const ff_png_chunk_handler ff_png_chunk_handlers[] = { - {"IHDR", ff_png_header_handler}, - {"IDAT", ff_png_data_handler}, - {"IEND", ff_png_end_handler}, - {"PLTE", ff_png_palette_handler}, +extern const ff_png_chunk_handler ff_png_chunk_handlers[]; - // From now on, the handlers will be for ancillary chunks - {"tRNS", ff_png_trans_handler}, - {NULL, NULL} // Terminator -}; - -ff_result ff_png_isvalid(ff_stream *stream); -ff_result ff_open_png(ff_stream *stream, ff_png_ctx **out_ctx, ff_flag require_valid); - -ff_result ff_png_normalize(ff_png_ctx *ctx, ff_image_ctx **out_data); +ff_result ff_png_normalize(ff_ctx* ctx, ff_png_ctx *png_ctx, ff_image_ctx **out_data); #endif |
