gl renderer: Don't draw all rounded clip nodes to a texture

We only need to do that if the rounde clip node intersects with the
outer one.
This commit is contained in:
Timm Bäder 2018-04-11 17:57:57 +02:00
parent 20f12f9ed7
commit 0336825537

View File

@ -745,14 +745,37 @@ render_rounded_clip_node (GskGLRenderer *self,
const float min_y = node->bounds.origin.y;
const float max_x = min_x + node->bounds.size.width;
const float max_y = min_y + node->bounds.size.height;
graphene_matrix_t scale_matrix;
GskRoundedRect child_clip = *gsk_rounded_clip_node_peek_clip (node);
GskRoundedRect transformed_clip;
GskRoundedRect prev_clip;
GskRenderNode *child = gsk_rounded_clip_node_get_child (node);
int texture_id;
gboolean is_offscreen;
int i;
transformed_clip = child_clip;
graphene_matrix_transform_bounds (&builder->current_modelview, &child_clip.bounds, &transformed_clip.bounds);
if (graphene_rect_contains_rect (&builder->current_clip.bounds,
&transformed_clip.bounds))
{
/* If they don't intersect at all, we can simply set
* the new clip and add the render ops */
for (i = 0; i < 4; i ++)
{
transformed_clip.corner[i].width *= scale;
transformed_clip.corner[i].height *= scale;
}
prev_clip = ops_set_clip (builder, &transformed_clip);
gsk_gl_renderer_add_render_ops (self, child, builder);
ops_set_clip (builder, &prev_clip);
}
else if (graphene_rect_intersection (&builder->current_clip.bounds,
&transformed_clip.bounds, NULL))
{
graphene_matrix_t scale_matrix;
gboolean is_offscreen;
int texture_id;
/* NOTE: We are *not* transforming the clip by the current modelview here.
* We instead draw the untransformed clip to a texture and then transform
* that texture.
@ -789,6 +812,8 @@ render_rounded_clip_node (GskGLRenderer *self,
{ { max_x, min_y }, { 1, 1 }, },
});
}
/* Else this node is entirely out of the current clip node and we don't draw it anyway. */
}
static inline void
render_color_matrix_node (GskGLRenderer *self,