From: Stefan Kangas Date: Mon, 14 Aug 2023 19:34:34 +0000 (+0200) Subject: Add native WebP support on macOS (Bug#59242) X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=17d3b70fbfcbb392b9a3e64f1ca05168cd16d3e8;p=emacs.git Add native WebP support on macOS (Bug#59242) * src/image.c (syms_of_image) [HAVE_NATIVE_IMAGE_API && HAVE_NS && NS_IMPL_COCOA]: Add webp as an image type. * src/nsimage.m (ns_can_use_native_image_api) [NS_IMPL_COCOA && !HAVE_WEBP]: Add webp to list of possible image types in the native image support lookup. --- diff --git a/src/image.c b/src/image.c index f2079fab6a3..7019bbf31be 100644 --- a/src/image.c +++ b/src/image.c @@ -12834,8 +12834,10 @@ non-numeric, there is no explicit limit on the size of images. */); add_image_type (Qpng); #endif -#if defined (HAVE_WEBP) || (defined (HAVE_NATIVE_IMAGE_API) \ - && defined (HAVE_HAIKU)) +#if defined (HAVE_WEBP) \ + || (defined (HAVE_NATIVE_IMAGE_API) \ + && ((defined (HAVE_NS) && defined (NS_IMPL_COCOA)) \ + || defined (HAVE_HAIKU))) DEFSYM (Qwebp, "webp"); DEFSYM (Qwebpdemux, "webpdemux"); add_image_type (Qwebp); diff --git a/src/nsimage.m b/src/nsimage.m index af8eb629989..b33124900bb 100644 --- a/src/nsimage.m +++ b/src/nsimage.m @@ -77,6 +77,10 @@ ns_can_use_native_image_api (Lisp_Object type) #ifndef HAVE_RSVG else if (EQ (type, Qsvg)) imageType = @"public.svg-image"; +#endif +#ifndef HAVE_WEBP + else if (EQ (type, Qwebp)) + imageType = @"org.webmproject.webp"; #endif else if (EQ (type, Qheic)) imageType = @"public.heic";