From e84c6acc4fcced6065d494a20c1feae88877d6c0 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Sat, 24 Mar 2018 21:33:08 +0100 Subject: [PATCH] rendernode: Remove renderer argument It's not needed to create Cairo nodes anymore. --- gsk/gskrendernode.h | 3 +-- gsk/gskrendernodeimpl.c | 22 +--------------------- gtk/gtksnapshot.c | 2 +- testsuite/gsk/test-render-nodes.c | 6 +++--- 4 files changed, 6 insertions(+), 27 deletions(-) diff --git a/gsk/gskrendernode.h b/gsk/gskrendernode.h index 6277bf74ce..8c8717d96d 100644 --- a/gsk/gskrendernode.h +++ b/gsk/gskrendernode.h @@ -178,8 +178,7 @@ float gsk_outset_shadow_node_get_blur_radius (GskRenderNode GDK_AVAILABLE_IN_ALL GskRenderNode * gsk_cairo_node_new (const graphene_rect_t *bounds); GDK_AVAILABLE_IN_ALL -cairo_t * gsk_cairo_node_get_draw_context (GskRenderNode *node, - GskRenderer *renderer); +cairo_t * gsk_cairo_node_get_draw_context (GskRenderNode *node); GDK_AVAILABLE_IN_ALL const cairo_surface_t * gsk_cairo_node_peek_surface (GskRenderNode *node); diff --git a/gsk/gskrendernodeimpl.c b/gsk/gskrendernodeimpl.c index 07aaecf713..51ae14cd42 100644 --- a/gsk/gskrendernodeimpl.c +++ b/gsk/gskrendernodeimpl.c @@ -1903,7 +1903,6 @@ gsk_cairo_node_new (const graphene_rect_t *bounds) /** * gsk_cairo_node_get_draw_context: * @node: a cairo #GskRenderNode - * @renderer: (nullable): Renderer to optimize for or %NULL for any * * Creates a Cairo context for drawing using the surface associated * to the render node. @@ -1914,15 +1913,13 @@ gsk_cairo_node_new (const graphene_rect_t *bounds) * cairo_destroy() when done drawing */ cairo_t * -gsk_cairo_node_get_draw_context (GskRenderNode *node, - GskRenderer *renderer) +gsk_cairo_node_get_draw_context (GskRenderNode *node) { GskCairoNode *self = (GskCairoNode *) node; int width, height; cairo_t *res; g_return_val_if_fail (GSK_IS_RENDER_NODE_TYPE (node, GSK_CAIRO_NODE), NULL); - g_return_val_if_fail (renderer == NULL || GSK_IS_RENDERER (renderer), NULL); width = ceilf (node->bounds.size.width); height = ceilf (node->bounds.size.height); @@ -1954,23 +1951,6 @@ gsk_cairo_node_get_draw_context (GskRenderNode *node, node->bounds.size.width, node->bounds.size.height); cairo_clip (res); - if (renderer && GSK_RENDERER_DEBUG_CHECK (renderer, SURFACE)) - { - const char *prefix; - prefix = g_getenv ("GSK_DEBUG_PREFIX"); - if (!prefix || g_str_has_prefix (node->name, prefix)) - { - cairo_save (res); - cairo_rectangle (res, - node->bounds.origin.x + 1, node->bounds.origin.y + 1, - node->bounds.size.width - 2, node->bounds.size.height - 2); - cairo_set_line_width (res, 2); - cairo_set_source_rgb (res, 1, 0, 0); - cairo_stroke (res); - cairo_restore (res); - } - } - return res; } diff --git a/gtk/gtksnapshot.c b/gtk/gtksnapshot.c index 420f7b6c87..201c7c2fb5 100644 --- a/gtk/gtksnapshot.c +++ b/gtk/gtksnapshot.c @@ -1372,7 +1372,7 @@ gtk_snapshot_append_cairo (GtkSnapshot *snapshot, gtk_snapshot_append_node (snapshot, node); gsk_render_node_unref (node); - cr = gsk_cairo_node_get_draw_context (node, snapshot->renderer); + cr = gsk_cairo_node_get_draw_context (node); cairo_translate (cr, current_state->translate_x, current_state->translate_y); diff --git a/testsuite/gsk/test-render-nodes.c b/testsuite/gsk/test-render-nodes.c index 6f8a6c69eb..672bfcd25e 100644 --- a/testsuite/gsk/test-render-nodes.c +++ b/testsuite/gsk/test-render-nodes.c @@ -134,7 +134,7 @@ cairo (void) cairo_t *cr; node = gsk_cairo_node_new (&GRAPHENE_RECT_INIT (0, 0, 200, 600)); - cr = gsk_cairo_node_get_draw_context (node, NULL); + cr = gsk_cairo_node_get_draw_context (node); cairo_set_source_rgb (cr, 1, 0, 0); cairo_rectangle (cr, 0, 0, 200, 200); @@ -159,7 +159,7 @@ cairo2 (void) int i, j; node = gsk_cairo_node_new (&GRAPHENE_RECT_INIT (0, 0, 200, 200)); - cr = gsk_cairo_node_get_draw_context (node, NULL); + cr = gsk_cairo_node_get_draw_context (node); cairo_set_source_rgb (cr, 1, 1, 1); @@ -263,7 +263,7 @@ ducky (void) node = gsk_cairo_node_new (&GRAPHENE_RECT_INIT (0, 0, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf))); - cr = gsk_cairo_node_get_draw_context (node, NULL); + cr = gsk_cairo_node_get_draw_context (node); gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); cairo_paint (cr); cairo_destroy (cr);