1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 14:25:06 +00:00

SharedGraphics: Minor tweaks in rect shattering code.

This commit is contained in:
Andreas Kling 2019-02-19 16:37:12 +01:00
parent 57546d8420
commit 210646edd2
2 changed files with 3 additions and 5 deletions

View file

@ -39,7 +39,6 @@ Vector<Rect> Rect::shatter(const Rect& hammer) const
Vector<Rect> pieces;
if (!intersects(hammer)) {
pieces.append(*this);
pieces.append(hammer);
return pieces;
}
Rect top_shard {
@ -63,7 +62,7 @@ Vector<Rect> Rect::shatter(const Rect& hammer) const
Rect right_shard {
hammer.x() + hammer.width(),
max(hammer.y(), y()),
(x() + width() - 1) - (hammer.x() + hammer.width() - 1),
right() - hammer.right(),
min((hammer.y() + hammer.height()), (y() + height())) - max(hammer.y(), y())
};
if (intersects(top_shard))