[gtk/wip/chergert/glproto: 86/94] stub out simple transform nodes
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto: 86/94] stub out simple transform nodes
- Date: Fri, 1 Jan 2021 21:30:52 +0000 (UTC)
commit c79380cd2a5481dba2e0ad7460e58f9b1580800f
Author: Christian Hergert <chergert redhat com>
Date: Wed Dec 30 11:33:09 2020 -0800
stub out simple transform nodes
gsk/next/gskglrenderjob.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 52 insertions(+), 1 deletion(-)
---
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index b9bbc9eab2..0b1b9f71b5 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -70,6 +70,9 @@ typedef struct _GskGLRenderModelview
graphene_matrix_t matrix;
} GskGLRenderModelview;
+static void gsk_gl_render_job_visit_node (GskGLRenderJob *job,
+ GskRenderNode *node);
+
static void
init_projection_matrix (graphene_matrix_t *projection,
const graphene_rect_t *viewport,
@@ -585,6 +588,51 @@ gsk_gl_render_job_visit_linear_gradient_node (GskGLRenderJob *job,
}
}
+static void
+gsk_gl_render_job_visit_transform_node (GskGLRenderJob *job,
+ GskRenderNode *node)
+{
+ GskTransform *transform = gsk_transform_node_get_transform (node);
+ const GskTransformCategory category = gsk_transform_get_category (transform);
+ GskRenderNode *child = gsk_transform_node_get_child (node);
+
+ switch (category)
+ {
+ case GSK_TRANSFORM_CATEGORY_IDENTITY:
+ gsk_gl_render_job_visit_node (job, child);
+ break;
+
+ case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
+ {
+ float dx, dy;
+
+ gsk_transform_to_translate (transform, &dx, &dy);
+ gsk_gl_render_job_offset (job, dx, dy);
+ gsk_gl_render_job_visit_node (job, child);
+ gsk_gl_render_job_offset (job, -dx, -dy);
+ }
+ break;
+
+ case GSK_TRANSFORM_CATEGORY_2D_AFFINE:
+ {
+ gsk_gl_render_job_push_modelview (job, transform);
+ gsk_gl_render_job_visit_node (job, child);
+ gsk_gl_render_job_pop_modelview (job);
+ }
+ break;
+
+ case GSK_TRANSFORM_CATEGORY_2D:
+ case GSK_TRANSFORM_CATEGORY_3D:
+ case GSK_TRANSFORM_CATEGORY_ANY:
+ case GSK_TRANSFORM_CATEGORY_UNKNOWN:
+ g_warning ("TODO: complex transform\n");
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+}
+
static void
gsk_gl_render_job_visit_node (GskGLRenderJob *job,
GskRenderNode *node)
@@ -637,6 +685,10 @@ gsk_gl_render_job_visit_node (GskGLRenderJob *job,
gsk_gl_render_job_visit_linear_gradient_node (job, node);
break;
+ case GSK_TRANSFORM_NODE:
+ gsk_gl_render_job_visit_transform_node (job, node);
+ break;
+
case GSK_BLEND_NODE:
case GSK_BLUR_NODE:
case GSK_BORDER_NODE:
@@ -657,7 +709,6 @@ gsk_gl_render_job_visit_node (GskGLRenderJob *job,
case GSK_SHADOW_NODE:
case GSK_TEXTURE_NODE:
case GSK_TEXT_NODE:
- case GSK_TRANSFORM_NODE:
break;
case GSK_NOT_A_RENDER_NODE:
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]