diff options
author | Matthias Clasen <mclasen@redhat.com> | 2021-09-13 14:59:20 -0400 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2021-09-17 00:25:22 +0200 |
commit | 5b82cf1145bbf73ce7f8ea96dc18da6eb0d83ded (patch) | |
tree | dd46673319a3be8e3edfbd3c81b18fa2691f8354 /gsk/gskrendernodeparser.c | |
parent | 95a0c93839746a8fd0e391c0545dfabec8b08498 (diff) | |
download | gtk+-5b82cf1145bbf73ce7f8ea96dc18da6eb0d83ded.tar.gz |
rendernodeparser: Use gdk_texture_save_to_png_bytes
Avoid cairo, and use our own api for saving png data.
Update affected test output.
Diffstat (limited to 'gsk/gskrendernodeparser.c')
-rw-r--r-- | gsk/gskrendernodeparser.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/gsk/gskrendernodeparser.c b/gsk/gskrendernodeparser.c index c4c721e2e3..fe5c55ac1e 100644 --- a/gsk/gskrendernodeparser.c +++ b/gsk/gskrendernodeparser.c @@ -2699,26 +2699,23 @@ render_node_print (Printer *p, case GSK_TEXTURE_NODE: { GdkTexture *texture = gsk_texture_node_get_texture (node); - cairo_surface_t *surface; - GByteArray *array; + GBytes *bytes; start_node (p, "texture"); append_rect_param (p, "bounds", &node->bounds); - surface = gdk_texture_download_surface (texture); - array = g_byte_array_new (); - cairo_surface_write_to_png_stream (surface, cairo_write_array, array); + bytes = gdk_texture_save_to_png_bytes (texture); _indent (p); g_string_append (p->str, "texture: url(\"data:image/png;base64,"); - b64 = base64_encode_with_linebreaks (array->data, array->len); + b64 = base64_encode_with_linebreaks (g_bytes_get_data (bytes, NULL), + g_bytes_get_size (bytes)); append_escaping_newlines (p->str, b64); g_free (b64); g_string_append (p->str, "\");\n"); end_node (p); - g_byte_array_free (array, TRUE); - cairo_surface_destroy (surface); + g_bytes_unref (bytes); } break; |