[gtk+/wip/ebassi/gsk-renderer: 97/126] gtk: Add convenience function for creating render nodes
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/ebassi/gsk-renderer: 97/126] gtk: Add convenience function for creating render nodes
- Date: Tue, 9 Aug 2016 16:38:54 +0000 (UTC)
commit 935d74ffa68a420f84900923d2391b6c0f877ee5
Author: Emmanuele Bassi <ebassi gnome org>
Date: Thu Aug 4 15:22:00 2016 +0100
gtk: Add convenience function for creating render nodes
GtkWidget.create_render_node() sets up a GskRenderNode appropriate for
rendering the contents of a widget, including its bounds,
transformation, and anchor point.
gtk/gtkwidget.c | 26 ++++++++++++++++++++++++++
gtk/gtkwidgetprivate.h | 4 ++++
2 files changed, 30 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 87e46be..2ef11a7 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -17462,6 +17462,32 @@ gtk_widget_get_renderer (GtkWidget *widget)
}
GskRenderNode *
+gtk_widget_create_render_node (GtkWidget *widget,
+ GskRenderer *renderer,
+ const char *name)
+{
+ GskRenderNode *res = gsk_renderer_create_render_node (renderer);
+ GtkAllocation allocation, clip;
+ graphene_point3d_t p;
+ graphene_rect_t bounds;
+ graphene_matrix_t m;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ gtk_widget_get_clip (widget, &clip);
+
+ graphene_rect_init (&bounds, 0, 0, clip.width, clip.height);
+ graphene_matrix_init_translate (&m, graphene_point3d_init (&p, allocation.x, allocation.y, 0));
+ graphene_point3d_init (&p, clip.x - allocation.x, clip.y - allocation.y, 0);
+
+ gsk_render_node_set_name (res, name);
+ gsk_render_node_set_bounds (res, &bounds);
+ gsk_render_node_set_transform (res, &m);
+ gsk_render_node_set_anchor_point (res, &p);
+
+ return res;
+}
+
+GskRenderNode *
gtk_widget_get_render_node (GtkWidget *widget,
GskRenderer *renderer)
{
diff --git a/gtk/gtkwidgetprivate.h b/gtk/gtkwidgetprivate.h
index 7d6aba0..7125f44 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -305,6 +305,10 @@ void gtk_widget_render (GtkWidget
GskRenderNode * gtk_widget_get_render_node (GtkWidget *widget,
GskRenderer *renderer);
+GskRenderNode * gtk_widget_create_render_node (GtkWidget *widget,
+ GskRenderer *renderer,
+ const char *name);
+
/* inline getters */
static inline gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]