diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2021-11-16 07:38:42 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2021-11-16 08:51:29 +0100 |
commit | 9bebb0a3fecb8fa8bca102f48d10e09e494a6b4d (patch) | |
tree | 0cdf448899f2c2714d2ffd00b83c1b2541ac4afc /fastiv-io.c | |
parent | 11b796945941d33beff624dabdbb20fbc0aabe3c (diff) | |
download | fiv-9bebb0a3fecb8fa8bca102f48d10e09e494a6b4d.tar.gz fiv-9bebb0a3fecb8fa8bca102f48d10e09e494a6b4d.tar.xz fiv-9bebb0a3fecb8fa8bca102f48d10e09e494a6b4d.zip |
Make this work at all in macOS/Homebrew
Diffstat (limited to 'fastiv-io.c')
-rw-r--r-- | fastiv-io.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fastiv-io.c b/fastiv-io.c index d02c2fe..ee43cd8 100644 --- a/fastiv-io.c +++ b/fastiv-io.c @@ -18,7 +18,11 @@ #include "config.h" #include <cairo.h> +#include <errno.h> #include <glib.h> +#include <glib/gstdio.h> + +#include <spng.h> #include <turbojpeg.h> #ifdef HAVE_LIBRAW #include <libraw.h> @@ -44,9 +48,6 @@ #define WUFFS_CONFIG__MODULE__ZLIB #include "wuffs-mirror-release-c/release/c/wuffs-v0.3.c" -#include <glib/gstdio.h> -#include <spng.h> - #include "xdg.h" #include "fastiv-io.h" @@ -495,7 +496,13 @@ open_librsvg(const gchar *data, gsize len, const gchar *path, GError **error) rsvg_handle_set_dpi(handle, 96); double w = 0, h = 0; +#if LIBRSVG_CHECK_VERSION(2, 51, 0) if (!rsvg_handle_get_intrinsic_size_in_pixels(handle, &w, &h)) { +#else + RsvgDimensionData dd = {}; + rsvg_handle_get_dimensions(handle, &dd); + if ((w = dd.width) <= 0 || (h = dd.height) <= 0) { +#endif RsvgRectangle viewbox = {}; gboolean has_viewport = FALSE; rsvg_handle_get_intrinsic_dimensions(handle, NULL, NULL, NULL, NULL, @@ -675,6 +682,10 @@ fastiv_io_open_from_data(const char *data, size_t len, const gchar *path, // --- Thumbnails -------------------------------------------------------------- +#ifndef __linux__ +#define st_mtim st_mtimespec +#endif // ! __linux__ + static int // tri-state check_spng_thumbnail_texts(struct spng_text *texts, uint32_t texts_len, const gchar *target, time_t mtime) |