mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
Add an offset to render nodes
This will let us account for the difference between clip and allocation.
This commit is contained in:
parent
ff20a68ca3
commit
7b204b0eea
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user