diff --git a/gdk/gdkgltexture.c b/gdk/gdkgltexture.c index a5be81e676..f8ff9344c1 100644 --- a/gdk/gdkgltexture.c +++ b/gdk/gdkgltexture.c @@ -24,7 +24,6 @@ #include "gdkglcontextprivate.h" #include "gdkmemoryformatprivate.h" #include "gdkmemorytextureprivate.h" -#include "gdktextureprivate.h" #include diff --git a/gdk/gdkpixbuf.c b/gdk/gdkpixbuf.c index 7a4e35962d..3e3a20336f 100644 --- a/gdk/gdkpixbuf.c +++ b/gdk/gdkpixbuf.c @@ -27,7 +27,6 @@ #include "gdkmemoryformatprivate.h" #include "gdkmemorytextureprivate.h" #include "gdksurface.h" -#include "gdktextureprivate.h" #include "gdktexturedownloaderprivate.h" #include diff --git a/gdk/gdktexture.c b/gdk/gdktexture.c index c37fd248aa..007901ffe8 100644 --- a/gdk/gdktexture.c +++ b/gdk/gdktexture.c @@ -741,9 +741,29 @@ gdk_texture_download (GdkTexture *texture, stride); } +/** + * gdk_texture_get_format: + * @self: a GdkTexture + * + * Gets the memory format most closely associated with the data of + * the texture. + * + * Note that it may not be an exact match for texture data + * stored on the GPU or with compression. + * + * The format can give an indication about the bit depth and opacity + * of the texture and is useful to determine the best format for + * downloading the texture. + * + * Returns: the preferred format for the texture's data + * + * Since: 4.10 + **/ GdkMemoryFormat gdk_texture_get_format (GdkTexture *self) { + g_return_val_if_fail (GDK_IS_TEXTURE (self), GDK_MEMORY_DEFAULT); + return self->format; } diff --git a/gdk/gdktexture.h b/gdk/gdktexture.h index 8ce4bae5b2..5a28f55ad0 100644 --- a/gdk/gdktexture.h +++ b/gdk/gdktexture.h @@ -24,6 +24,7 @@ #endif #include +#include #include #include @@ -82,6 +83,8 @@ GDK_AVAILABLE_IN_ALL int gdk_texture_get_width (GdkTexture *texture) G_GNUC_PURE; GDK_AVAILABLE_IN_ALL int gdk_texture_get_height (GdkTexture *texture) G_GNUC_PURE; +GDK_AVAILABLE_IN_4_10 +GdkMemoryFormat gdk_texture_get_format (GdkTexture *self) G_GNUC_PURE; GDK_AVAILABLE_IN_ALL void gdk_texture_download (GdkTexture *texture, diff --git a/gdk/gdktextureprivate.h b/gdk/gdktextureprivate.h index fd9f78053e..3a2330c373 100644 --- a/gdk/gdktextureprivate.h +++ b/gdk/gdktextureprivate.h @@ -43,7 +43,6 @@ void gdk_texture_do_download (GdkTexture GdkMemoryFormat format, guchar *data, gsize stride); -GdkMemoryFormat gdk_texture_get_format (GdkTexture *self); gboolean gdk_texture_set_render_data (GdkTexture *self, gpointer key, gpointer data, diff --git a/gdk/loaders/gdkpng.c b/gdk/loaders/gdkpng.c index fb4158f3cb..d5991fde38 100644 --- a/gdk/loaders/gdkpng.c +++ b/gdk/loaders/gdkpng.c @@ -24,7 +24,6 @@ #include "gdkmemorytexture.h" #include "gdkprofilerprivate.h" #include "gdktexturedownloaderprivate.h" -#include "gdktextureprivate.h" #include "gsk/gl/fp16private.h" #include #include diff --git a/gdk/loaders/gdktiff.c b/gdk/loaders/gdktiff.c index 489a962bd8..d112ff1626 100644 --- a/gdk/loaders/gdktiff.c +++ b/gdk/loaders/gdktiff.c @@ -24,7 +24,6 @@ #include "gdkmemorytexture.h" #include "gdkprofilerprivate.h" #include "gdktexturedownloaderprivate.h" -#include "gdktextureprivate.h" #include diff --git a/gsk/gl/gskgldriver.c b/gsk/gl/gskgldriver.c index 4e38dad685..727ce079bb 100644 --- a/gsk/gl/gskgldriver.c +++ b/gsk/gl/gskgldriver.c @@ -35,7 +35,6 @@ #include "gskgliconlibraryprivate.h" #include "gskglprogramprivate.h" #include "gskglshadowlibraryprivate.h" -#include "gskgltextureprivate.h" #include "fp16private.h" #include