gl renderer: Add a short cut for repeat nodes that don't repeat

These happen and we don't even need to draw the child to a texture.
This commit is contained in:
Timm Bäder 2019-11-19 10:45:02 +01:00
parent 604f44da11
commit 600ce68210

View File

@ -1085,12 +1085,11 @@ render_linear_gradient_node (GskGLRenderer *self,
}
static inline void
render_clip_node (GskGLRenderer *self,
GskRenderNode *node,
RenderOpBuilder *builder)
render_clipped_child (GskGLRenderer *self,
RenderOpBuilder *builder,
const graphene_rect_t *clip,
GskRenderNode *child)
{
const graphene_rect_t *clip = gsk_clip_node_peek_clip (node);
GskRenderNode *child = gsk_clip_node_get_child (node);
graphene_rect_t transformed_clip;
graphene_rect_t intersection;
GskRoundedRect child_clip;
@ -1108,6 +1107,17 @@ render_clip_node (GskGLRenderer *self,
ops_pop_clip (builder);
}
static inline void
render_clip_node (GskGLRenderer *self,
GskRenderNode *node,
RenderOpBuilder *builder)
{
const graphene_rect_t *clip = gsk_clip_node_peek_clip (node);
GskRenderNode *child = gsk_clip_node_get_child (node);
render_clipped_child (self, builder, clip, child);
}
static inline void
get_inner_rect (const GskRoundedRect *rect,
graphene_rect_t *out)
@ -1962,6 +1972,15 @@ render_repeat_node (GskGLRenderer *self,
return;
}
/* If the size of the repeat node is smaller than the size of the
* child node, we don't repeat at all and can just draw that part
* of the child texture... */
if (graphene_rect_contains_rect (child_bounds, &node->bounds))
{
render_clipped_child (self, builder, &node->bounds, child);
return;
}
/* Draw the entire child on a texture */
add_offscreen_ops (self, builder,
&child->bounds,