summaryrefslogtreecommitdiff
path: root/gtk/gtkcssimagebuiltin.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2016-11-16 20:51:53 +0100
committerBenjamin Otte <otte@redhat.com>2016-11-16 20:51:53 +0100
commit6d9725f7fdc97bbb5c04a22fb3f664bda686f048 (patch)
tree6136f438a45980687705e66150e2c27b954995ff /gtk/gtkcssimagebuiltin.c
parentc22a9a03f91d47dd729eee40990adee67134a688 (diff)
downloadgtk+-6d9725f7fdc97bbb5c04a22fb3f664bda686f048.tar.gz
snapshot: Add infrastructure to snapshot CSS images
Use this infrastructure to render builtin images. Which means from now on, GtkCheckbutton, GtkSpinner and a few others use snapshots.
Diffstat (limited to 'gtk/gtkcssimagebuiltin.c')
-rw-r--r--gtk/gtkcssimagebuiltin.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/gtk/gtkcssimagebuiltin.c b/gtk/gtkcssimagebuiltin.c
index 3c045d9a55..841ae91d26 100644
--- a/gtk/gtkcssimagebuiltin.c
+++ b/gtk/gtkcssimagebuiltin.c
@@ -643,3 +643,31 @@ gtk_css_image_builtin_draw (GtkCssImage *image,
}
}
+void
+gtk_css_image_builtin_snapshot (GtkCssImage *image,
+ GtkSnapshot *snapshot,
+ double width,
+ double height,
+ GtkCssImageBuiltinType image_type)
+{
+ cairo_t *cr;
+
+ g_return_if_fail (GTK_IS_CSS_IMAGE (image));
+ g_return_if_fail (snapshot != NULL);
+ g_return_if_fail (width > 0);
+ g_return_if_fail (height > 0);
+
+ if (!GTK_IS_CSS_IMAGE_BUILTIN (image))
+ {
+ gtk_css_image_snapshot (image, snapshot, width, height);
+ return;
+ }
+
+ cr = gtk_snapshot_append_cairo_node (snapshot,
+ &(graphene_rect_t)GRAPHENE_RECT_INIT (0, 0, width, height),
+ "BuiltinImage<%d>", (int) image_type);
+ gtk_css_image_builtin_draw (image, cr, width, height, image_type);
+ cairo_destroy (cr);
+}
+
+