gsk: Remove child-transform from render nodes

The child-transform is useful only if we also provide clipping to the
parent nodes, otherwise children will just be drawn outside of the
parent's bounds.

We'll introduce child transforms either at a higher layer, or once we
add clipping support to GskRenderNode.
This commit is contained in:
Emmanuele Bassi 2016-08-08 19:34:03 +01:00
parent fd4a1cdad6
commit 56c93a7661
4 changed files with 3 additions and 41 deletions

View File

@ -55,7 +55,6 @@ gsk_render_node_contains
gsk_render_node_set_bounds
gsk_render_node_set_transform
gsk_render_node_set_anchor_point
gsk_render_node_set_child_transform
gsk_render_node_set_opacity
gsk_render_node_set_hidden
gsk_render_node_is_hidden

View File

@ -177,7 +177,6 @@ gsk_render_node_init (GskRenderNode *self)
graphene_rect_init_from_rect (&self->bounds, graphene_rect_zero ());
graphene_matrix_init_identity (&self->transform);
graphene_matrix_init_identity (&self->child_transform);
graphene_point3d_init (&self->anchor_point, 0.f, 0.f, 0.f);
@ -961,31 +960,6 @@ gsk_render_node_set_anchor_point (GskRenderNode *node,
graphene_point3d_init_from_point (&node->anchor_point, offset);
}
/**
* gsk_render_node_set_child_transform:
* @node: a #GskRenderNode
* @transform: (nullable): a transformation matrix
*
* Sets the transformation matrix used when rendering the children
* of @node.
*
* Since: 3.22
*/
void
gsk_render_node_set_child_transform (GskRenderNode *node,
const graphene_matrix_t *transform)
{
g_return_if_fail (GSK_IS_RENDER_NODE (node));
g_return_if_fail (node->is_mutable);
if (transform == NULL)
graphene_matrix_init_identity (&node->child_transform);
else
graphene_matrix_init_from_matrix (&node->child_transform, transform);
node->child_transform_set = !graphene_matrix_is_identity (&node->child_transform);
}
/**
* gsk_render_node_set_opacity:
* @node: a #GskRenderNode
@ -1177,11 +1151,10 @@ gsk_render_node_update_world_matrix (GskRenderNode *node,
if (force || node->needs_world_matrix_update)
{
GSK_NOTE (RENDER_NODE, g_print ("Updating cached world matrix on node %p [parent=%p, t_set=%s, ct_set=%s]\n",
GSK_NOTE (RENDER_NODE, g_print ("Updating cached world matrix on node %p [parent=%p, t_set=%s]\n",
node,
node->parent != NULL ? node->parent : 0,
node->transform_set ? "y" : "n",
node->parent != NULL && node->parent->child_transform_set ? "y" : "n"));
node->transform_set ? "y" : "n"));
if (node->parent == NULL)
{
@ -1195,10 +1168,7 @@ gsk_render_node_update_world_matrix (GskRenderNode *node,
GskRenderNode *parent = node->parent;
graphene_matrix_t tmp;
if (parent->child_transform_set)
graphene_matrix_init_from_matrix (&tmp, &parent->child_transform);
else
graphene_matrix_init_identity (&tmp);
graphene_matrix_init_identity (&tmp);
if (node->transform_set)
graphene_matrix_multiply (&tmp, &node->transform, &tmp);

View File

@ -98,9 +98,6 @@ GDK_AVAILABLE_IN_3_22
void gsk_render_node_set_anchor_point (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
void gsk_render_node_set_opacity (GskRenderNode *node,
double opacity);
GDK_AVAILABLE_IN_3_22

View File

@ -55,15 +55,11 @@ struct _GskRenderNode
graphene_point3d_t anchor_point;
/* Transformations applied to the children of the node */
graphene_matrix_t child_transform;
/* Bit fields; leave at the end */
gboolean is_mutable : 1;
gboolean hidden : 1;
gboolean opaque : 1;
gboolean transform_set : 1;
gboolean child_transform_set : 1;
gboolean needs_world_matrix_update : 1;
};