Add an offset to render nodes

This will let us account for the difference between
clip and allocation.
This commit is contained in:
Matthias Clasen 2016-08-04 01:04:25 -04:00 committed by Emmanuele Bassi
parent ff20a68ca3
commit 7b204b0eea
3 changed files with 23 additions and 0 deletions

View File

@ -178,6 +178,7 @@ gsk_render_node_init (GskRenderNode *self)
graphene_matrix_init_identity (&self->transform);
graphene_matrix_init_identity (&self->child_transform);
graphene_point3d_init (&self->offset, 0.f, 0.f, 0.f);
self->opacity = 1.0;
@ -934,6 +935,23 @@ gsk_render_node_set_transform (GskRenderNode *node,
else
graphene_matrix_init_from_matrix (&node->transform, transform);
graphene_matrix_translate (&node->transform, &node->offset);
node->transform_set = !graphene_matrix_is_identity (&node->transform);
}
void
gsk_render_node_set_offset (GskRenderNode *node,
const graphene_point3d_t *offset)
{
g_return_if_fail (GSK_IS_RENDER_NODE (node));
g_return_if_fail (node->is_mutable);
graphene_point3d_scale (&node->offset, -1, &node->offset);
graphene_matrix_translate (&node->transform, &node->offset);
graphene_point3d_init_from_point (&node->offset, offset);
graphene_matrix_translate (&node->transform, &node->offset);
node->transform_set = !graphene_matrix_is_identity (&node->transform);
}

View File

@ -95,6 +95,9 @@ GDK_AVAILABLE_IN_3_22
void gsk_render_node_set_transform (GskRenderNode *node,
const graphene_matrix_t *transform);
GDK_AVAILABLE_IN_3_22
void gsk_render_node_set_offset (GskRenderNode *node,
const graphene_point3d_t *offset);
GDK_AVAILABLE_IN_3_22
void gsk_render_node_set_child_transform (GskRenderNode *node,
const graphene_matrix_t *transform);
GDK_AVAILABLE_IN_3_22

View File

@ -53,6 +53,8 @@ struct _GskRenderNode
/* Transformations applied to the node */
graphene_matrix_t transform;
graphene_point3d_t offset;
/* Transformations applied to the children of the node */
graphene_matrix_t child_transform;