gpu: ceil() offscreen size before generating offscreen

The goal is to generate an offscreen at 1x scale.
When not ceil()ing the numbers the offscreen code would do it *and*
adjust the scale accordingly, so we'd end up with something like a
1.01x scale.

And that would cause the code to reenter this codepath with the goal to
generate an offscreen at 1x scale.
And indeed, this would lead to infinite recursion.

Tests included.

Fixes #6553
This commit is contained in:
Benjamin Otte
2024-03-22 16:18:41 +01:00
parent 9fe9ea34fd
commit 3080e2974d
4 changed files with 17 additions and 0 deletions

View File

@@ -2077,6 +2077,8 @@ gsk_gpu_node_processor_add_texture_scale_node (GskGpuNodeProcessor *self,
/* now intersect with actual node bounds */
if (!gsk_rect_intersection (&clip_bounds, &node->bounds, &clip_bounds))
return;
clip_bounds.size.width = ceilf (clip_bounds.size.width);
clip_bounds.size.height = ceilf (clip_bounds.size.height);
offscreen = gsk_gpu_node_processor_create_offscreen (self->frame,
graphene_vec2_one (),
&clip_bounds,

View File

@@ -0,0 +1,14 @@
color {
bounds: 0 0 3 2;
color: rgb(0,0,0);
}
transform {
transform: scale(2);
child: texture-scale {
bounds: 0 0 1.5 1;
filter: nearest;
texture: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAIAAACQd1PeAAAADElEQVQImWNoYGAAAAGEAIGs40g+\
AAAAAElFTkSuQmCC\
");
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 B

View File

@@ -171,6 +171,7 @@ compare_render_tests = [
'texture-scale-filters-nocairo',
'texture-scale-magnify-10000x',
'texture-scale-magnify-rotate',
'texture-scale-nearest-noninteger-scaled-nogl',
'texture-scale-nearest-vs-linear',
'texture-scale-offset',
'texture-scale-stripes',