Mercurial > hg > openttd
changeset 4429:2b238a14e5ba draft
(svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
author | tron <tron@openttd.org> |
---|---|
date | Mon, 28 Aug 2006 07:33:51 +0000 |
parents | 491e7fa6ab26 |
children | 744802a3b210 |
files | gfx.c gfx.h main_gui.c rail_gui.c smallmap_gui.c train_gui.c |
diffstat | 6 files changed, 16 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/gfx.c +++ b/gfx.c @@ -1880,43 +1880,43 @@ 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;
--- a/gfx.h +++ b/gfx.h @@ -85,7 +85,7 @@ void GfxInitPalettes(void); -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); /* window.c */ void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
--- a/main_gui.c +++ b/main_gui.c @@ -2110,7 +2110,7 @@ } } - if (!FillDrawPixelInfo(&tmp_dpi, NULL, 141, 1, 358, 11)) return true; + if (!FillDrawPixelInfo(&tmp_dpi, 141, 1, 358, 11)) return true; old_dpi = _cur_dpi; _cur_dpi = &tmp_dpi;
--- a/rail_gui.c +++ b/rail_gui.c @@ -674,7 +674,7 @@ y_offset = newstations ? 90 : 0; /* Set up a clipping area for the '/' station preview */ - if (FillDrawPixelInfo(&tmp_dpi, NULL, 7, 26 + y_offset, 66, 48)) { + if (FillDrawPixelInfo(&tmp_dpi, 7, 26 + y_offset, 66, 48)) { old_dpi = _cur_dpi; _cur_dpi = &tmp_dpi; if (!DrawStationTile(32, 16, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) { @@ -684,7 +684,7 @@ } /* Set up a clipping area for the '\' station preview */ - if (FillDrawPixelInfo(&tmp_dpi, NULL, 75, 26 + y_offset, 66, 48)) { + if (FillDrawPixelInfo(&tmp_dpi, 75, 26 + y_offset, 66, 48)) { old_dpi = _cur_dpi; _cur_dpi = &tmp_dpi; if (!DrawStationTile(32, 16, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
--- a/smallmap_gui.c +++ b/smallmap_gui.c @@ -836,7 +836,7 @@ } } - if (!FillDrawPixelInfo(&new_dpi, NULL, 3, 17, w->width - 28 + 22, w->height - 64 - 11)) + if (!FillDrawPixelInfo(&new_dpi, 3, 17, w->width - 28 + 22, w->height - 64 - 11)) return; DrawSmallMap(&new_dpi, w, _smallmap_type, _smallmap_show_towns);