]> git.eshelyaron.com Git - emacs.git/commitdiff
Add native WebP support on macOS (Bug#59242)
authorStefan Kangas <stefankangas@gmail.com>
Mon, 14 Aug 2023 19:34:34 +0000 (21:34 +0200)
committerStefan Kangas <stefankangas@gmail.com>
Mon, 14 Aug 2023 19:34:34 +0000 (21:34 +0200)
* 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.

src/image.c
src/nsimage.m

index f2079fab6a3dd4bc387b0bbf4a763b7976f305bb..7019bbf31be773e795cddbc08ef1a44d45fec6a1 100644 (file)
@@ -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);
index af8eb629989b3e01a325a4d7c2c3647642a19902..b33124900bbb1d0b0af749747959eee22701641a 100644 (file)
@@ -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";