aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMatthew Hoops2012-03-22 00:38:12 -0400
committerMatthew Hoops2012-03-22 00:38:12 -0400
commit57abb8f8439e9f8aeaf584a0d7b2e6407f09ea3c (patch)
treeb763d724d34f89bc61ff46f4bce351ef5b96a451 /common
parent3c3576a224b92c703b4e8ea20008ac8a069980dd (diff)
downloadscummvm-rg350-57abb8f8439e9f8aeaf584a0d7b2e6407f09ea3c.tar.gz
scummvm-rg350-57abb8f8439e9f8aeaf584a0d7b2e6407f09ea3c.tar.bz2
scummvm-rg350-57abb8f8439e9f8aeaf584a0d7b2e6407f09ea3c.zip
COMMON: Make Rect::center() more readable
Thanks to Fingolfin for the suggestion
Diffstat (limited to 'common')
-rw-r--r--common/rect.h5
1 files changed, 2 insertions, 3 deletions
diff --git a/common/rect.h b/common/rect.h
index 50ef0201dd..2bd3affafe 100644
--- a/common/rect.h
+++ b/common/rect.h
@@ -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);
}
};