From f2eb7621b43db91d5c618a3c17acea3a057c09a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C5=99emysl=20Eric=20Janouch?= Date: Sat, 22 Jan 2022 20:49:45 +0100 Subject: [PATCH] Bump Wuffs, add TGA support through it --- README.adoc | 5 +++-- fiv-io.c | 10 ++++++++-- wuffs-mirror-release-c | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.adoc b/README.adoc index 456a590..f43cc59 100644 --- a/README.adoc +++ b/README.adoc @@ -8,8 +8,9 @@ image::fiv.webp["Screenshot of both the browser and the viewer"] Features -------- - Uses a compact thumbnail view, helping you browse collections comfortably. - - Supports BMP, (A)PNG, GIF, JPEG, WebP directly, plus optionally raw photos, - HEIC, AVIF, SVG, X11 cursors and TIFF, or whatever gdk-pixbuf loads. + - Supports BMP, (A)PNG, GIF, TGA, JPEG, WebP directly, plus optionally raw + photos, HEIC, AVIF, SVG, X11 cursors and TIFF, or whatever your gdk-pixbuf + modules manage to load. - Employs high-performance file format libraries: Wuffs and libjpeg-turbo. - Makes use of 30-bit X.org visuals, whenever it's possible and appropriate. - Has a notion of pages, and tries to load all included content within files. 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) diff --git a/wuffs-mirror-release-c b/wuffs-mirror-release-c index ebbecaa..cc74cb4 160000 --- a/wuffs-mirror-release-c +++ b/wuffs-mirror-release-c @@ -1 +1 @@ -Subproject commit ebbecaa2fb439eff0aeedafadb4c2a984446dee8 +Subproject commit cc74cb4d30f48c3f5e312e48a8ed87e009f62d9b