rendernode-tool: Save to tiff
authorBenjamin Otte <otte@redhat.com>
Wed, 26 Jul 2023 21:30:34 +0000 (23:30 +0200)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 28 Jul 2023 06:06:14 +0000 (09:06 +0300)
If the save filename ends in .tiff, save to tiff instead.

For now this is a sneaky autodetect feature, not sure if/how to make it
more explicit.

tools/gtk-rendernode-tool-render.c

index c8fb133c2a15fdb22fff4733635f679d87392c12..77be8ea412e00a5494f151754d90e673d4551c39 100644 (file)
@@ -85,8 +85,11 @@ render_file (const char *filename,
         }
     }
 
-
-  bytes = gdk_texture_save_to_png_bytes (texture);
+  if (g_str_has_suffix (save_to, ".tif") ||
+      g_str_has_suffix (save_to, ".tiff"))
+    bytes = gdk_texture_save_to_tiff_bytes (texture);
+  else
+    bytes = gdk_texture_save_to_png_bytes (texture);
 
   if (g_file_set_contents (save_to,
                            g_bytes_get_data (bytes, NULL),