summaryrefslogtreecommitdiff
path: root/gfx.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-08-28 07:33:51 +0000
committertron <tron@openttd.org>2006-08-28 07:33:51 +0000
commit3306d9829f18d5499e4af1295d45cd03aaffd973 (patch)
tree7bdfd7c5d958ecb70ce91a2e6f5a707140d4f90d /gfx.c
parent4e36c4a349543bf6599559ee36ddfda15c584a6b (diff)
downloadopenttd-3306d9829f18d5499e4af1295d45cd03aaffd973.tar.xz
(svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
Diffstat (limited to 'gfx.c')
-rw-r--r--gfx.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/gfx.c b/gfx.c
index a6b1b4ec5..0dc3fbf4f 100644
--- a/gfx.c
+++ b/gfx.c
@@ -1880,43 +1880,43 @@ void MarkWholeScreenDirty(void)
SetDirtyBlocks(0, 0, _screen.width, _screen.height);
}
-bool FillDrawPixelInfo(DrawPixelInfo *n, const DrawPixelInfo *o, int left, int top, int width, int height)
+bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
{
- int t;
-
- if (o == NULL) o = _cur_dpi;
+ const DrawPixelInfo *o = _cur_dpi;
n->zoom = 0;
assert(width > 0);
assert(height > 0);
- n->left = 0;
if ((left -= o->left) < 0) {
width += left;
if (width < 0) return false;
n->left = -left;
left = 0;
+ } else {
+ n->left = 0;
}
- if ((t=width + left - o->width) > 0) {
- width -= t;
+ if (width > o->width - left) {
+ width = o->width - left;
if (width < 0) return false;
}
n->width = width;
- n->top = 0;
if ((top -= o->top) < 0) {
height += top;
if (height < 0) return false;
n->top = -top;
top = 0;
+ } else {
+ n->top = 0;
}
n->dst_ptr = o->dst_ptr + left + top * (n->pitch = o->pitch);
- if ((t=height + top - o->height) > 0) {
- height -= t;
+ if (height > o->height - top) {
+ height = o->height - top;
if (height < 0) return false;
}
n->height = height;