mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 17:50:10 +00:00
gpu: Add an epsilon before ceil()ing for offscreen size
Avoids getting the scale wrong when due to a rounding error our pixel-aligned rectangle is 5.000000003px big and we ceil() to 6px and produce blurry output. Fixes #6439
This commit is contained in:
parent
86db9e2ce0
commit
afc7b46264
@ -44,6 +44,11 @@
|
||||
#include "gdk/gdkrgbaprivate.h"
|
||||
#include "gdk/gdksubsurfaceprivate.h"
|
||||
|
||||
/* the epsilon we allow pixels to be off due to rounding errors.
|
||||
* Chosen rather randomly.
|
||||
*/
|
||||
#define EPSILON 0.001
|
||||
|
||||
/* A note about coordinate systems
|
||||
*
|
||||
* The rendering code keeps track of multiple coordinate systems to optimize rendering as
|
||||
@ -339,8 +344,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);
|
||||
area.height = ceilf (graphene_vec2_get_y (scale) * viewport->size.height);
|
||||
area.width = ceilf (graphene_vec2_get_x (scale) * viewport->size.width - EPSILON);
|
||||
area.height = ceilf (graphene_vec2_get_y (scale) * viewport->size.height - EPSILON);
|
||||
|
||||
image = gsk_gpu_device_create_offscreen_image (gsk_gpu_frame_get_device (frame),
|
||||
FALSE,
|
||||
|
@ -206,11 +206,11 @@ variants = {
|
||||
}
|
||||
|
||||
compare_xfails = {
|
||||
'ngl': { 'repeat-scaling': ['clipped'], # 6429
|
||||
'ngl': {
|
||||
'repeat-scaling': ['clipped'], # 6429
|
||||
'radial-gradient-with-64-colorstops': ['clipped'],
|
||||
'offscreen-pixel-alignment2': ['clipped'], # 6439
|
||||
},
|
||||
'vulkan': { 'offscreen-pixel-alignment2': ['clipped'], # 6439
|
||||
'vulkan': {
|
||||
'big-checkerboard': ['clipped'], # 6444
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user