[gtk+/wip/ebassi/gsk-renderer: 83/135] 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: 83/135] gtk: Add convenience function for creating render nodes
- Date: Mon, 17 Oct 2016 16:28:51 +0000 (UTC)
commit fb9413d4649f01c20ad9ed420ba1cc728bcf46fc
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 f4be397..0f52e2d 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -16065,6 +16065,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 65f2bc8..8bc8ffd 100644
--- a/gtk/gtkwidgetprivate.h
+++ b/gtk/gtkwidgetprivate.h
@@ -300,6 +300,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]