From f2eb7621b43db91d5c618a3c17acea3a057c09a6 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sat, 22 Jan 2022 20:49:45 +0100 Subject: Bump Wuffs, add TGA support through it --- fiv-io.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'fiv-io.c') diff --git a/fiv-io.c b/fiv-io.c index b9ca4f1..e216434 100644 --- a/fiv-io.c +++ b/fiv-io.c @@ -74,6 +74,7 @@ #define WUFFS_CONFIG__MODULE__GIF #define WUFFS_CONFIG__MODULE__LZW #define WUFFS_CONFIG__MODULE__PNG +#define WUFFS_CONFIG__MODULE__TGA #define WUFFS_CONFIG__MODULE__ZLIB #include "wuffs-mirror-release-c/release/c/wuffs-v0.3.c" @@ -2403,7 +2404,7 @@ fiv_io_open( { // TODO(p): Don't always load everything into memory, test type first, // so that we can reject non-pictures early. Wuffs only needs the first - // 16 bytes (soon 12) to make a guess right now. + // 17 bytes to make a guess right now. // // LibRaw poses an issue--there is no good registry for identification // of supported files. Many of them are compliant TIFF files. @@ -2436,7 +2437,7 @@ fiv_io_open_from_data(const char *data, size_t len, const gchar *uri, wuffs_base__make_slice_u8((uint8_t *) data, len); cairo_surface_t *surface = NULL; - switch (wuffs_base__magic_number_guess_fourcc(prefix)) { + switch (wuffs_base__magic_number_guess_fourcc(prefix, true /* closed */)) { case WUFFS_BASE__FOURCC__BMP: // Note that BMP can redirect into another format, // which is so far unsupported here. @@ -2454,6 +2455,11 @@ fiv_io_open_from_data(const char *data, size_t len, const gchar *uri, wuffs_png__decoder__alloc_as__wuffs_base__image_decoder, data, len, profile, error); break; + case WUFFS_BASE__FOURCC__TGA: + surface = open_wuffs_using( + wuffs_tga__decoder__alloc_as__wuffs_base__image_decoder, data, len, + profile, error); + break; case WUFFS_BASE__FOURCC__JPEG: surface = enhance ? open_libjpeg_enhanced(data, len, profile, error) -- cgit v1.2.3-54-g00ecf