From 604f44da11da9b46dae6b3d812d8ede29eb2b8ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= Date: Tue, 19 Nov 2019 10:31:21 +0100 Subject: [PATCH] gl renderer: Fix repeat nodes that don't repeat Fixes #2234 --- gsk/gl/gskglrenderer.c | 4 ++-- gsk/resources/glsl/repeat.fs.glsl | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index 1e1086d761..357e09108d 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -1973,8 +1973,8 @@ render_repeat_node (GskGLRenderer *self, ops_set_texture (builder, region.texture_id); op = ops_begin (builder, OP_CHANGE_REPEAT); - op->child_bounds[0] = 0; /* Both currently unused */ - op->child_bounds[1] = 0; + op->child_bounds[0] = (node->bounds.origin.x - child_bounds->origin.x) / child_bounds->size.width; + op->child_bounds[1] = (node->bounds.origin.y - child_bounds->origin.y) / child_bounds->size.height; op->child_bounds[2] = node->bounds.size.width / child_bounds->size.width; op->child_bounds[3] = node->bounds.size.height / child_bounds->size.height; diff --git a/gsk/resources/glsl/repeat.fs.glsl b/gsk/resources/glsl/repeat.fs.glsl index a58047335e..070b56abe6 100644 --- a/gsk/resources/glsl/repeat.fs.glsl +++ b/gsk/resources/glsl/repeat.fs.glsl @@ -21,8 +21,8 @@ void main() { float mapped_x = (vUv.x - u_texture_rect.x) / tw; float mapped_y = (vUv.y - u_texture_rect.y) / th; - float wrapped_x = wrap(mapped_x * u_child_bounds.z, 1.0); - float wrapped_y = wrap(mapped_y * u_child_bounds.w, 1.0); + float wrapped_x = u_child_bounds.x + wrap(mapped_x * u_child_bounds.z, 1.0); + float wrapped_y = u_child_bounds.y + wrap(mapped_y * u_child_bounds.w, 1.0); vec2 tp; tp.x = u_texture_rect.x + (wrapped_x * tw);