[common] rects: fix error introduced in cosmetics patch

`x2` and `y2` are required here as they need to operate on the original
x & y before they are clamped. Can't believe I missed this *facepalm*
This commit is contained in:
Geoffrey McRae 2021-10-26 23:35:09 +11:00
parent 6078b11200
commit affc3f51f8

View File

@ -259,14 +259,15 @@ int rectsMergeOverlapping(FrameDamageRect * rects, int count)
if (removed[j] || !rectIntersects(rects + i, rects + j)) if (removed[j] || !rectIntersects(rects + i, rects + j))
continue; continue;
const uint32_t x2 = max(rects[i].x + rects[i].width,
rects[j].x + rects[j].width);
const uint32_t y2 = max(rects[i].y + rects[i].height,
rects[j].y + rects[j].height);
rects[i].x = min(rects[i].x, rects[j].x); rects[i].x = min(rects[i].x, rects[j].x);
rects[i].y = min(rects[i].y, rects[j].y); rects[i].y = min(rects[i].y, rects[j].y);
rects[i].width = x2 - rects[i].x;
rects[i].width = max(rects[i].x + rects[i].width, rects[i].height = y2 - rects[i].y;
rects[j].x + rects[j].width) - rects[i].x;
rects[i].height = max(rects[i].y + rects[i].height,
rects[j].y + rects[j].height) - rects[i].y;
removed[j] = true; removed[j] = true;
changed = true; changed = true;