mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-13 14:00:09 +00:00
gsk: Add some debug helpers
This commit is contained in:
parent
ea94bac79e
commit
d7c3235cd0
@ -1121,19 +1121,21 @@ gsk_gl_driver_lookup_shader (GskGLDriver *self,
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
static void
|
void
|
||||||
write_atlas_to_png (GskGLDriver *driver,
|
gsk_gl_driver_save_texture_to_png (GskGLDriver *driver,
|
||||||
GskGLTextureAtlas *atlas,
|
int texture_id,
|
||||||
const char *filename)
|
int width,
|
||||||
|
int height,
|
||||||
|
const char *filename)
|
||||||
{
|
{
|
||||||
GdkGLTextureBuilder *builder;
|
GdkGLTextureBuilder *builder;
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
|
|
||||||
builder = gdk_gl_texture_builder_new ();
|
builder = gdk_gl_texture_builder_new ();
|
||||||
gdk_gl_texture_builder_set_context (builder, gsk_gl_driver_get_context (driver));
|
gdk_gl_texture_builder_set_context (builder, gsk_gl_driver_get_context (driver));
|
||||||
gdk_gl_texture_builder_set_id (builder, atlas->texture_id);
|
gdk_gl_texture_builder_set_id (builder, texture_id);
|
||||||
gdk_gl_texture_builder_set_width (builder, atlas->width);
|
gdk_gl_texture_builder_set_width (builder, width);
|
||||||
gdk_gl_texture_builder_set_height (builder, atlas->height);
|
gdk_gl_texture_builder_set_height (builder, height);
|
||||||
|
|
||||||
texture = gdk_gl_texture_builder_build (builder, NULL, NULL);
|
texture = gdk_gl_texture_builder_build (builder, NULL, NULL);
|
||||||
gdk_texture_save_to_png (texture, filename);
|
gdk_texture_save_to_png (texture, filename);
|
||||||
@ -1168,7 +1170,7 @@ gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
|
|||||||
G_DIR_SEPARATOR_S,
|
G_DIR_SEPARATOR_S,
|
||||||
(int)self->current_frame_id,
|
(int)self->current_frame_id,
|
||||||
atlas->texture_id);
|
atlas->texture_id);
|
||||||
write_atlas_to_png (self, atlas, filename);
|
gsk_gl_driver_save_texture_to_png (self, atlas->texture_id, atlas->width, atlas->height, filename);
|
||||||
g_free (filename);
|
g_free (filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +176,13 @@ GskGLProgram * gsk_gl_driver_lookup_shader (GskGLDriver *s
|
|||||||
GError **error);
|
GError **error);
|
||||||
|
|
||||||
#ifdef G_ENABLE_DEBUG
|
#ifdef G_ENABLE_DEBUG
|
||||||
|
void gsk_gl_driver_save_texture_to_png (GskGLDriver *self,
|
||||||
|
int texture_id,
|
||||||
|
int width,
|
||||||
|
int height,
|
||||||
|
const char *filename);
|
||||||
void gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
|
void gsk_gl_driver_save_atlases_to_png (GskGLDriver *self,
|
||||||
const char *directory);
|
const char *filename);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline GskGLTexture *
|
static inline GskGLTexture *
|
||||||
|
Loading…
Reference in New Issue
Block a user