summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimm Bäder <mail@baedert.org>2019-08-10 15:29:22 +0200
committerTimm Bäder <mail@baedert.org>2019-08-11 09:05:31 +0200
commit13c0a9e27b72ffe0a83a205402317326c7fa87f9 (patch)
treea1a1e9905760d59609f5fb57a8e41ee62f7114e4
parent4c70bf6c9c82813bb0ce4c18f2fb46bf748d726d (diff)
downloadgtk+-13c0a9e27b72ffe0a83a205402317326c7fa87f9.tar.gz
iconcache: Replace broken debugging code
-rw-r--r--gsk/gl/gskgliconcache.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/gsk/gl/gskgliconcache.c b/gsk/gl/gskgliconcache.c
index 2975434dbc..bb66e8dfaf 100644
--- a/gsk/gl/gskgliconcache.c
+++ b/gsk/gl/gskgliconcache.c
@@ -213,10 +213,22 @@ gsk_gl_icon_cache_lookup_or_add (GskGLIconCache *self,
cairo_surface_destroy (padded_surface);
#if 0
- /* Some obvious debugging */
- static int k;
- gsk_gl_image_write_to_png (&atlas->image, self->gl_driver,
- g_strdup_printf ("icon%d.png", k ++));
+ {
+ static int k;
+ const int stride = cairo_format_stride_for_width (CAIRO_FORMAT_ARGB32, atlas->width);
+ guchar *data = g_malloc (atlas->height * stride);
+ cairo_surface_t *s;
+ char *filename = g_strdup_printf ("atlas_%u_%d.png", atlas->texture_id, k++);
+
+ glBindTexture (GL_TEXTURE_2D, atlas->texture_id);
+ glGetTexImage (GL_TEXTURE_2D, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, data);
+ s = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32, atlas->width, atlas->height, stride);
+ cairo_surface_write_to_png (s, filename);
+
+ cairo_surface_destroy (s);
+ g_free (data);
+ g_free (filename);
+ }
#endif
}
}