From fd78bd3eaffef4fab5098c0fb52dd074684d4e9e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 7 Aug 2024 08:21:01 -0400 Subject: [PATCH] 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,