diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c index aea8d9914a..1dde458316 100644 --- a/gsk/gpu/gskgpunodeprocessor.c +++ b/gsk/gpu/gskgpunodeprocessor.c @@ -1431,6 +1431,7 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self, { GskTransform *clip_transform; float scale_x, scale_y, old_pixels, new_pixels; + graphene_rect_t scissor; clip_transform = gsk_transform_transform (gsk_transform_translate (NULL, &self->offset), transform); gsk_gpu_clip_init_copy (&old_clip, &self->clip); @@ -1500,6 +1501,23 @@ gsk_gpu_node_processor_add_transform_node (GskGpuNodeProcessor *self, self->modelview = gsk_transform_scale (self->modelview, 1 / scale_x, 1 / scale_y); graphene_vec2_init (&self->scale, scale_x, scale_y); self->offset = *graphene_point_zero (); + + if (gsk_gpu_node_processor_rect_device_to_clip (self, + &GSK_RECT_INIT_CAIRO (&self->scissor), + &scissor)) + { + GskGpuClip scissored_clip; + if (gsk_gpu_clip_intersect_rect (&scissored_clip, &self->clip, &scissor)) + gsk_gpu_clip_init_copy (&self->clip, &scissored_clip); + + if (self->clip.type == GSK_GPU_CLIP_ALL_CLIPPED) + { + self->offset = old_offset; + self->scale = old_scale; + gsk_gpu_clip_init_copy (&self->clip, &old_clip); + } + } + } break; diff --git a/testsuite/gsk/compare/offscreen-forced-downscale-all-clipped.node b/testsuite/gsk/compare/offscreen-forced-downscale-all-clipped.node new file mode 100644 index 0000000000..63e48d5791 --- /dev/null +++ b/testsuite/gsk/compare/offscreen-forced-downscale-all-clipped.node @@ -0,0 +1,22 @@ +clip { + clip: 1 -9 26 116; + child: container { + color { + bounds: -10 -10 20 120; + color: rgb(255,255,255); + } + transform { + transform: rotate(45); + child: transform { + transform: rotate(45); + child: shadow { + shadows: rgb(0,0,0) 0 1; + child: color { + bounds: 0 0 100 1; + color: rgb(255,0,0); + } + } + } + } + } +} diff --git a/testsuite/gsk/compare/offscreen-forced-downscale-all-clipped.png b/testsuite/gsk/compare/offscreen-forced-downscale-all-clipped.png new file mode 100644 index 0000000000..ac0f054e3c Binary files /dev/null and b/testsuite/gsk/compare/offscreen-forced-downscale-all-clipped.png differ diff --git a/testsuite/gsk/meson.build b/testsuite/gsk/meson.build index e914219bee..ca6d210f82 100644 --- a/testsuite/gsk/meson.build +++ b/testsuite/gsk/meson.build @@ -114,6 +114,7 @@ compare_render_tests = [ 'mipmap-with-1x1', 'nested-rounded-clips', 'offscreen-forced-downscale', + 'offscreen-forced-downscale-all-clipped', 'offscreen-fractional-translate-nogl', 'offscreen-pixel-alignment-nogl-nocairo', 'offscreen-pixel-alignment2',