mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-12 12:09:15 +00:00
COMMON: Make Rect::center() more readable
Thanks to Fingolfin for the suggestion
This commit is contained in:
parent
3c3576a224
commit
57abb8f843
@ -247,9 +247,8 @@ struct Rect {
|
||||
* @note the center point is rounded up and left when given an odd width and height
|
||||
*/
|
||||
static Rect center(int16 cx, int16 cy, int16 w, int16 h) {
|
||||
int dx = w / 2;
|
||||
int dy = h / 2;
|
||||
return Rect(cx - dx, cy - dy, cx + dx + (w & 1), cy + dy + (h & 1));
|
||||
int x = cx - w / 2, y = cy - h / 2;
|
||||
return Rect(x, y, x + w, y + h);
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user