From fd78bd3eaffef4fab5098c0fb52dd074684d4e9e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Aug 2024 08:21:01 -0400 Subject: [PATCH 1/2] memoryformat: Add a debug helper I need this often enough that I'll just put it here. --- gdk/gdkmemoryformat.c | 8 ++++++++ gdk/gdkmemoryformatprivate.h | 1 + 2 files changed, 9 insertions(+) diff --git a/gdk/gdkmemoryformat.c b/gdk/gdkmemoryformat.c index 6522c52e76..6f513d8737 100644 --- a/gdk/gdkmemoryformat.c +++ b/gdk/gdkmemoryformat.c @@ -1524,6 +1524,14 @@ gdk_memory_format_get_depth (GdkMemoryFormat format, return depth; } +const char * +gdk_memory_depth_get_name (GdkMemoryDepth depth) +{ + const char *names[] = { "none", "u8", "u8-srgb", "u16", "f16", "f32" }; + + return names[depth]; +} + /* * gdk_memory_depth_merge: * @depth1: the first depth diff --git a/gdk/gdkmemoryformatprivate.h b/gdk/gdkmemoryformatprivate.h index f72f0aabe6..57f55bd5fd 100644 --- a/gdk/gdkmemoryformatprivate.h +++ b/gdk/gdkmemoryformatprivate.h @@ -66,6 +66,7 @@ GdkMemoryDepth gdk_memory_depth_merge (GdkMemoryDepth GdkMemoryDepth depth2) G_GNUC_CONST; GdkMemoryFormat gdk_memory_depth_get_format (GdkMemoryDepth depth) G_GNUC_CONST; GdkMemoryFormat gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth) G_GNUC_CONST; +const char * gdk_memory_depth_get_name (GdkMemoryDepth depth); void gdk_memory_format_gl_format (GdkMemoryFormat format, gboolean gles, GLint *out_internal_format, From ffdc8c8f60627373671180cf9d6174815c585c44 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Aug 2024 08:39:05 -0400 Subject: [PATCH 2/2] gsk: Drop some unused code Nobody is using gsk_gpu_download_png_op, and we are going to refactor the download op code. --- gsk/gpu/gskgpudownloadop.c | 29 ----------------------------- gsk/gpu/gskgpudownloadopprivate.h | 5 ----- 2 files changed, 34 deletions(-) diff --git a/gsk/gpu/gskgpudownloadop.c b/gsk/gpu/gskgpudownloadop.c index d8e3f272f7..50ead4b12f 100644 --- a/gsk/gpu/gskgpudownloadop.c +++ b/gsk/gpu/gskgpudownloadop.c @@ -380,32 +380,3 @@ gsk_gpu_download_op (GskGpuFrame *frame, self->func = func, self->user_data = user_data; } - -static void -gsk_gpu_download_save_png_cb (gpointer filename, - GdkTexture *texture) -{ - gdk_texture_save_to_png (texture, filename); - - g_free (filename); -} - -void -gsk_gpu_download_png_op (GskGpuFrame *frame, - GskGpuImage *image, - const char *filename_format, - ...) -{ - va_list args; - char *filename; - - va_start (args, filename_format); - filename = g_strdup_vprintf (filename_format, args); - va_end (args); - - gsk_gpu_download_op (frame, - image, - FALSE, - gsk_gpu_download_save_png_cb, - filename); -} diff --git a/gsk/gpu/gskgpudownloadopprivate.h b/gsk/gpu/gskgpudownloadopprivate.h index 5d8f4d7df3..285782787e 100644 --- a/gsk/gpu/gskgpudownloadopprivate.h +++ b/gsk/gpu/gskgpudownloadopprivate.h @@ -13,10 +13,5 @@ void gsk_gpu_download_op (GskGpuF GskGpuDownloadFunc func, gpointer user_data); -void gsk_gpu_download_png_op (GskGpuFrame *frame, - GskGpuImage *image, - const char *filename_format, - ...) G_GNUC_PRINTF(3, 4); - G_END_DECLS