aboutsummaryrefslogtreecommitdiff
path: root/fiv-io.c
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-01-22 20:49:45 +0100
committerPřemysl Eric Janouch <p@janouch.name>2022-01-22 21:02:56 +0100
commitf2eb7621b43db91d5c618a3c17acea3a057c09a6 (patch)
tree128dc58cbea8c961fd9a8fe6e97360432252eeda /fiv-io.c
parent8877e171083c58ffe5af2cc5534f3ea11160a8da (diff)
downloadfiv-f2eb7621b43db91d5c618a3c17acea3a057c09a6.tar.gz
fiv-f2eb7621b43db91d5c618a3c17acea3a057c09a6.tar.xz
fiv-f2eb7621b43db91d5c618a3c17acea3a057c09a6.zip
Bump Wuffs, add TGA support through it
Diffstat (limited to 'fiv-io.c')
-rw-r--r--fiv-io.c10
1 files changed, 8 insertions, 2 deletions
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)