summaryrefslogtreecommitdiff
path: root/gtk/gtkrender.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2018-07-14 21:53:29 +0200
committerBenjamin Otte <otte@redhat.com>2018-07-24 20:55:45 +0200
commit14408b7485ad29a5ce6c2cfa82660b4f53f89b9a (patch)
tree5f98bbea98f8fa7733715f979f3f1710a3bbbd2a /gtk/gtkrender.c
parent2a11baf6ea440fe81f90ba45373f9931dad6ce9d (diff)
downloadgtk+-14408b7485ad29a5ce6c2cfa82660b4f53f89b9a.tar.gz
render: Make gtk_render_background() use the snapshot API
This removes a lot of duplicated code.
Diffstat (limited to 'gtk/gtkrender.c')
-rw-r--r--gtk/gtkrender.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/gtk/gtkrender.c b/gtk/gtkrender.c
index b42b402269..0481d67756 100644
--- a/gtk/gtkrender.c
+++ b/gtk/gtkrender.c
@@ -29,7 +29,6 @@
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcsstransformvalueprivate.h"
#include "gtkhslaprivate.h"
-#include "gtkrenderbackgroundprivate.h"
#include "gtkrenderborderprivate.h"
#include "gtkrendericonprivate.h"
#include "gtkstylecontextprivate.h"
@@ -238,14 +237,26 @@ gtk_render_background (GtkStyleContext *context,
gdouble width,
gdouble height)
{
+ GtkSnapshot *snapshot;
+ GskRenderNode *node;
+
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (cr != NULL);
if (width <= 0 || height <= 0)
return;
- gtk_css_style_render_background (gtk_style_context_lookup_style (context),
- cr, x, y, width, height);
+ snapshot = gtk_snapshot_new ();
+ gtk_snapshot_render_background (snapshot, context, x, y, width, height);
+ node = gtk_snapshot_free_to_node (snapshot);
+ if (node == NULL)
+ return;
+
+ cairo_save (cr);
+ gsk_render_node_draw (node, cr);
+ cairo_restore (cr);
+
+ gsk_render_node_unref (node);
}
/**