mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r6184) Remove the unused (because it was NULL in all callers) second parameter of FillDrawPixelInfo() and simplify some expressions
This commit is contained in:
parent
523519c8ec
commit
2eb76813ed
20
gfx.c
20
gfx.c
|
@ -1880,43 +1880,43 @@ void MarkWholeScreenDirty(void)
|
||||||
SetDirtyBlocks(0, 0, _screen.width, _screen.height);
|
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;
|
const DrawPixelInfo *o = _cur_dpi;
|
||||||
|
|
||||||
if (o == NULL) o = _cur_dpi;
|
|
||||||
|
|
||||||
n->zoom = 0;
|
n->zoom = 0;
|
||||||
|
|
||||||
assert(width > 0);
|
assert(width > 0);
|
||||||
assert(height > 0);
|
assert(height > 0);
|
||||||
|
|
||||||
n->left = 0;
|
|
||||||
if ((left -= o->left) < 0) {
|
if ((left -= o->left) < 0) {
|
||||||
width += left;
|
width += left;
|
||||||
if (width < 0) return false;
|
if (width < 0) return false;
|
||||||
n->left = -left;
|
n->left = -left;
|
||||||
left = 0;
|
left = 0;
|
||||||
|
} else {
|
||||||
|
n->left = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((t=width + left - o->width) > 0) {
|
if (width > o->width - left) {
|
||||||
width -= t;
|
width = o->width - left;
|
||||||
if (width < 0) return false;
|
if (width < 0) return false;
|
||||||
}
|
}
|
||||||
n->width = width;
|
n->width = width;
|
||||||
|
|
||||||
n->top = 0;
|
|
||||||
if ((top -= o->top) < 0) {
|
if ((top -= o->top) < 0) {
|
||||||
height += top;
|
height += top;
|
||||||
if (height < 0) return false;
|
if (height < 0) return false;
|
||||||
n->top = -top;
|
n->top = -top;
|
||||||
top = 0;
|
top = 0;
|
||||||
|
} else {
|
||||||
|
n->top = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
n->dst_ptr = o->dst_ptr + left + top * (n->pitch = o->pitch);
|
n->dst_ptr = o->dst_ptr + left + top * (n->pitch = o->pitch);
|
||||||
|
|
||||||
if ((t=height + top - o->height) > 0) {
|
if (height > o->height - top) {
|
||||||
height -= t;
|
height = o->height - top;
|
||||||
if (height < 0) return false;
|
if (height < 0) return false;
|
||||||
}
|
}
|
||||||
n->height = height;
|
n->height = height;
|
||||||
|
|
2
gfx.h
2
gfx.h
|
@ -85,7 +85,7 @@ void MarkWholeScreenDirty(void);
|
||||||
|
|
||||||
void GfxInitPalettes(void);
|
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 */
|
/* window.c */
|
||||||
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
|
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
|
||||||
|
|
|
@ -2110,7 +2110,7 @@ static bool DrawScrollingStatusText(const NewsItem *ni, int pos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
old_dpi = _cur_dpi;
|
||||||
_cur_dpi = &tmp_dpi;
|
_cur_dpi = &tmp_dpi;
|
||||||
|
|
|
@ -674,7 +674,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
|
||||||
y_offset = newstations ? 90 : 0;
|
y_offset = newstations ? 90 : 0;
|
||||||
|
|
||||||
/* Set up a clipping area for the '/' station preview */
|
/* 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;
|
old_dpi = _cur_dpi;
|
||||||
_cur_dpi = &tmp_dpi;
|
_cur_dpi = &tmp_dpi;
|
||||||
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) {
|
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_X, _railstation.station_class, _railstation.station_type)) {
|
||||||
|
@ -684,7 +684,7 @@ static void StationBuildWndProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up a clipping area for the '\' station preview */
|
/* 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;
|
old_dpi = _cur_dpi;
|
||||||
_cur_dpi = &tmp_dpi;
|
_cur_dpi = &tmp_dpi;
|
||||||
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
|
if (!DrawStationTile(32, 16, _cur_railtype, AXIS_Y, _railstation.station_class, _railstation.station_type)) {
|
||||||
|
|
|
@ -836,7 +836,7 @@ static void SmallMapWindowProc(Window *w, WindowEvent *e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
return;
|
||||||
|
|
||||||
DrawSmallMap(&new_dpi, w, _smallmap_type, _smallmap_show_towns);
|
DrawSmallMap(&new_dpi, w, _smallmap_type, _smallmap_show_towns);
|
||||||
|
|
|
@ -361,7 +361,7 @@ static void DrawTrainImage(const Vehicle *v, int x, int y, int count, int skip,
|
||||||
int highlight_l = 0;
|
int highlight_l = 0;
|
||||||
int highlight_r = 0;
|
int highlight_r = 0;
|
||||||
|
|
||||||
if (!FillDrawPixelInfo(&tmp_dpi, NULL, x - 2, y - 1, count + 1, 14)) return;
|
if (!FillDrawPixelInfo(&tmp_dpi, x - 2, y - 1, count + 1, 14)) return;
|
||||||
|
|
||||||
count = (count * 8) / _traininfo_vehicle_width;
|
count = (count * 8) / _traininfo_vehicle_width;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue