egl: Round damage rectangles properly

We need to round outwards and a 1x1 rectangle with offset 0.5,0.5 should
end up as a 3x3 rectangle with offset 0,0 when rounded, not as a 2x2
rectangle.
This commit is contained in:
Benjamin Otte 2024-08-13 00:35:20 +02:00
parent 4e77667ab8
commit 5d056eabf6

View File

@ -718,8 +718,8 @@ gdk_gl_context_real_end_frame (GdkDrawContext *draw_context,
cairo_region_get_rectangle (painted, i, &rect);
rects[j++] = (int) floor (rect.x * scale);
rects[j++] = (int) floor ((surface_height - rect.height - rect.y) * scale);
rects[j++] = (int) ceil (rect.width * scale);
rects[j++] = (int) ceil (rect.height * scale);
rects[j++] = (int) ceil ((rect.x + rect.width) * scale) - floor (rect.x * scale);
rects[j++] = (int) ceil ((surface_height - rect.y) * scale) - floor ((surface_height - rect.height - rect.y) * scale);
}
priv->eglSwapBuffersWithDamage (gdk_display_get_egl_display (display), egl_surface, rects, n_rects);
g_free (heap_rects);