Bump Wuffs, add TGA support through it

This commit is contained in:
Přemysl Eric Janouch 2022-01-22 20:49:45 +01:00
parent 8877e17108
commit f2eb7621b4
Signed by: p
GPG Key ID: A0420B94F92B9493
3 changed files with 12 additions and 5 deletions

View File

@ -8,8 +8,9 @@ image::fiv.webp["Screenshot of both the browser and the viewer"]
Features Features
-------- --------
- Uses a compact thumbnail view, helping you browse collections comfortably. - Uses a compact thumbnail view, helping you browse collections comfortably.
- Supports BMP, (A)PNG, GIF, JPEG, WebP directly, plus optionally raw photos, - Supports BMP, (A)PNG, GIF, TGA, JPEG, WebP directly, plus optionally raw
HEIC, AVIF, SVG, X11 cursors and TIFF, or whatever gdk-pixbuf loads. 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. - Employs high-performance file format libraries: Wuffs and libjpeg-turbo.
- Makes use of 30-bit X.org visuals, whenever it's possible and appropriate. - 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. - Has a notion of pages, and tries to load all included content within files.

View File

@ -74,6 +74,7 @@
#define WUFFS_CONFIG__MODULE__GIF #define WUFFS_CONFIG__MODULE__GIF
#define WUFFS_CONFIG__MODULE__LZW #define WUFFS_CONFIG__MODULE__LZW
#define WUFFS_CONFIG__MODULE__PNG #define WUFFS_CONFIG__MODULE__PNG
#define WUFFS_CONFIG__MODULE__TGA
#define WUFFS_CONFIG__MODULE__ZLIB #define WUFFS_CONFIG__MODULE__ZLIB
#include "wuffs-mirror-release-c/release/c/wuffs-v0.3.c" #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, // 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 // 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 // LibRaw poses an issue--there is no good registry for identification
// of supported files. Many of them are compliant TIFF files. // 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); wuffs_base__make_slice_u8((uint8_t *) data, len);
cairo_surface_t *surface = NULL; 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: case WUFFS_BASE__FOURCC__BMP:
// Note that BMP can redirect into another format, // Note that BMP can redirect into another format,
// which is so far unsupported here. // 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, wuffs_png__decoder__alloc_as__wuffs_base__image_decoder, data, len,
profile, error); profile, error);
break; 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: case WUFFS_BASE__FOURCC__JPEG:
surface = enhance surface = enhance
? open_libjpeg_enhanced(data, len, profile, error) ? open_libjpeg_enhanced(data, len, profile, error)

@ -1 +1 @@
Subproject commit ebbecaa2fb439eff0aeedafadb4c2a984446dee8 Subproject commit cc74cb4d30f48c3f5e312e48a8ed87e009f62d9b