[common] fix out by one error in rectsIntersect

This commit is contained in:
Geoffrey McRae 2021-10-24 13:31:41 +11:00
parent ad6e3f96e6
commit bc7cbf1173

View file

@ -203,10 +203,11 @@ void rectsFramebufferToBuffer(FrameDamageRect * rects, int count,
inline static bool rectIntersects(const FrameDamageRect * r1, const FrameDamageRect * r2) inline static bool rectIntersects(const FrameDamageRect * r1, const FrameDamageRect * r2)
{ {
return r1->x < r2->x + r2->width && return !(
r1->x + r1->width > r2->x && r1->x > r2->x + r2->width ||
r1->y < r2->y + r2->height && r2->x > r1->x + r1->width ||
r1->y + r1->height > r2->y; r1->y > r2->y + r2->height ||
r2->y > r1->y + r1->height);
} }
int rectsMergeOverlapping(FrameDamageRect * rects, int count) int rectsMergeOverlapping(FrameDamageRect * rects, int count)