From 9a6e61e5101bb3214562395af393119b7f0a8929 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Wed, 10 Jul 2024 00:26:57 +0200 Subject: [PATCH] rect: There's no coverage witout overlap The rectangles need to touch/overlap in both directions, otherwise there's no coverage that covers both rectangles. Test included. Fixes rendering glitches in various apps when redrawing. Fixes: #6849 --- gsk/gskrectprivate.h | 7 ++----- testsuite/gsk/opaque/not-near-0-0-50-50.node | 6 ++++++ 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 testsuite/gsk/opaque/not-near-0-0-50-50.node diff --git a/gsk/gskrectprivate.h b/gsk/gskrectprivate.h index 413b202143..daae5516a8 100644 --- a/gsk/gskrectprivate.h +++ b/gsk/gskrectprivate.h @@ -131,9 +131,10 @@ gsk_rect_coverage (const graphene_rect_t *r1, x2max = MAX (r1->origin.x + r1->size.width, r2->origin.x + r2->size.width); y2max = MAX (r1->origin.y + r1->size.height, r2->origin.y + r2->size.height); - if (x2min >= x1max) + if (x2min >= x1max && y2min >= y1max) { float w, h; + w = x2min - x1max; h = y2max - y1min; size2 = w * h; @@ -142,11 +143,7 @@ gsk_rect_coverage (const graphene_rect_t *r1, r = GRAPHENE_RECT_INIT (x1max, y1min, w, h); size = size2; } - } - if (y2min >= y1max) - { - float w, h; w = x2max - x1min; h = y2min - y1max; size2 = w * h; diff --git a/testsuite/gsk/opaque/not-near-0-0-50-50.node b/testsuite/gsk/opaque/not-near-0-0-50-50.node new file mode 100644 index 0000000000..1d0deefc23 --- /dev/null +++ b/testsuite/gsk/opaque/not-near-0-0-50-50.node @@ -0,0 +1,6 @@ +color { + bounds: 0 0 50 50; +} +color { + bounds: 1000 0 10 10; +}