diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 357e09108d..9fd13a3480 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -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,