Make this work at all in macOS/Homebrew

This commit is contained in:
2021-11-16 07:38:42 +01:00
parent 11b7969459
commit 9bebb0a3fe
4 changed files with 39 additions and 9 deletions

View File

@@ -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)