gl renderer: Use simple offset for selected offset node children

This commit is contained in:
Timm Bäder 2018-05-01 08:19:48 +02:00
parent e0205eb27c
commit 3a5a9d9233

View File

@ -625,21 +625,40 @@ render_offset_node (GskGLRenderer *self,
RenderOpBuilder *builder)
{
GskRenderNode *child = gsk_offset_node_get_child (node);
graphene_matrix_t prev_mv;
graphene_matrix_t transform, transformed_mv;
const guint child_type = gsk_render_node_get_node_type (child);
const float dx = gsk_offset_node_get_x_offset (node);
const float dy = gsk_offset_node_get_y_offset (node);
graphene_matrix_init_translate (&transform,
&GRAPHENE_POINT3D_INIT(
gsk_offset_node_get_x_offset (node),
gsk_offset_node_get_y_offset (node),
1.0
));
graphene_matrix_multiply (&transform, &builder->current_modelview, &transformed_mv);
prev_mv = ops_set_modelview (builder, &transformed_mv);
/* TODO: We do this only for selected node type we know handle
* builder->dx/dy correctly. That should be "all nodes" eventually.
*/
switch (child_type)
{
case GSK_TEXT_NODE:
case GSK_TEXTURE_NODE:
case GSK_COLOR_NODE:
{
ops_offset (builder, dx, dy);
gsk_gl_renderer_add_render_ops (self, child, builder);
ops_offset (builder, - dx, - dy);
}
break;
gsk_gl_renderer_add_render_ops (self, child, builder);
default:
{
graphene_matrix_t prev_mv;
graphene_matrix_t transform, transformed_mv;
ops_set_modelview (builder, &prev_mv);
graphene_matrix_init_translate (&transform,
&GRAPHENE_POINT3D_INIT(dx, dy, 1.0));
graphene_matrix_multiply (&transform, &builder->current_modelview, &transformed_mv);
prev_mv = ops_set_modelview (builder, &transformed_mv);
gsk_gl_renderer_add_render_ops (self, child, builder);
ops_set_modelview (builder, &prev_mv);
}
}
}
static inline void