mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 17:50:10 +00:00
gpu: Handle tiny offscreens
Due to rounding errors, it is possible after intersecting a lot of
rectangles to end up with a tiny size for an offscreen. And because we
allow an epsilon before ceil()ing to an integer (see commit afc7b46264
for details) it is now possible that we end up with a size of 0.
Avoid that by always enforcing a minimum size of 1px.
Test included
The test uses a different codepath to arrive at the same problem - it
specifies the small size instead of triggering it via rounding errors
and clipping like the original bug (and most likely the more common case
to encounter this problem.
Fixes #6656
This commit is contained in:
parent
4856e115a9
commit
719021e1f4
@ -345,8 +345,8 @@ gsk_gpu_node_processor_init_draw (GskGpuNodeProcessor *self,
|
||||
|
||||
area.x = 0;
|
||||
area.y = 0;
|
||||
area.width = ceilf (graphene_vec2_get_x (scale) * viewport->size.width - EPSILON);
|
||||
area.height = ceilf (graphene_vec2_get_y (scale) * viewport->size.height - EPSILON);
|
||||
area.width = MAX (1, ceilf (graphene_vec2_get_x (scale) * viewport->size.width - EPSILON));
|
||||
area.height = MAX (1, ceilf (graphene_vec2_get_y (scale) * viewport->size.height - EPSILON));
|
||||
|
||||
image = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (frame),
|
||||
FALSE,
|
||||
|
13
testsuite/gsk/compare/repeat-tiny-nogl-nocairo.node
Normal file
13
testsuite/gsk/compare/repeat-tiny-nogl-nocairo.node
Normal file
@ -0,0 +1,13 @@
|
||||
color {
|
||||
color: black;
|
||||
bounds: 0 0 20 20;
|
||||
}
|
||||
|
||||
repeat {
|
||||
bounds: 0 0 20 20;
|
||||
child: color {
|
||||
color: red;
|
||||
/* 1/1024 */
|
||||
bounds: 0 0 0.0009765625 0.0009765625;
|
||||
}
|
||||
}
|
BIN
testsuite/gsk/compare/repeat-tiny-nogl-nocairo.png
Normal file
BIN
testsuite/gsk/compare/repeat-tiny-nogl-nocairo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 83 B |
@ -136,6 +136,7 @@ compare_render_tests = [
|
||||
'repeat-repeats-nested-nogl',
|
||||
'repeat-scaling',
|
||||
'repeat-texture',
|
||||
'repeat-tiny-nogl-nocairo',
|
||||
'repeating-gradient-scaled',
|
||||
'reuse-of-texture-nested-in-offscreens',
|
||||
'rounded-clip-with-huge-bounds-nogl',
|
||||
|
Loading…
Reference in New Issue
Block a user