mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r2534) Small cleanup
This commit is contained in:
parent
3f91650d6e
commit
83f72f696a
22
gfx.c
22
gfx.c
|
@ -1659,24 +1659,29 @@ void RedrawScreenRect(int left, int top, int right, int bottom)
|
|||
void DrawDirtyBlocks(void)
|
||||
{
|
||||
byte *b = _dirty_blocks;
|
||||
int x = 0;
|
||||
int y = 0;
|
||||
const int w = (_screen.width + 63) & ~63;
|
||||
const int h = (_screen.height + 7) & ~7;
|
||||
int x;
|
||||
int y;
|
||||
|
||||
y = 0;
|
||||
do {
|
||||
x = 0;
|
||||
do {
|
||||
if (*b != 0) {
|
||||
int left,top;
|
||||
int left;
|
||||
int top;
|
||||
int right = x + 64;
|
||||
int bottom = y;
|
||||
byte *p = b;
|
||||
int h2;
|
||||
|
||||
// First try coalescing downwards
|
||||
do {
|
||||
*p = 0;
|
||||
p += DIRTY_BYTES_PER_LINE;
|
||||
bottom += 8;
|
||||
} while (bottom != h && *p);
|
||||
} while (bottom != h && *p != 0);
|
||||
|
||||
// Try coalescing to the right too.
|
||||
h2 = (bottom - y) >> 3;
|
||||
|
@ -1690,7 +1695,7 @@ void DrawDirtyBlocks(void)
|
|||
do {
|
||||
if (!*p2) goto no_more_coalesc;
|
||||
p2 += DIRTY_BYTES_PER_LINE;
|
||||
} while (--h);
|
||||
} while (--h != 0);
|
||||
|
||||
// Wohoo, can combine it one step to the right!
|
||||
// Do that, and clear the bits.
|
||||
|
@ -1701,9 +1706,9 @@ void DrawDirtyBlocks(void)
|
|||
do {
|
||||
*p2 = 0;
|
||||
p2 += DIRTY_BYTES_PER_LINE;
|
||||
} while (--h);
|
||||
} while (--h != 0);
|
||||
}
|
||||
no_more_coalesc:;
|
||||
no_more_coalesc:
|
||||
|
||||
left = x;
|
||||
top = y;
|
||||
|
@ -1718,7 +1723,8 @@ void DrawDirtyBlocks(void)
|
|||
}
|
||||
|
||||
}
|
||||
} while (b++, (x+=64) != w || (x=0,b+=-(w>>6)+DIRTY_BYTES_PER_LINE,(y+=8) != h));
|
||||
} while (b++, (x += 64) != w);
|
||||
} while (b += -(w >> 6) + DIRTY_BYTES_PER_LINE, (y += 8) != h);
|
||||
|
||||
_invalid_rect.left = w;
|
||||
_invalid_rect.top = h;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#define M(r, g, b) { r, g, b }
|
||||
static Colour _palettes[][256] = {
|
||||
static const Colour _palettes[][256] = {
|
||||
/* palette 1 (TTD Windows) */
|
||||
{
|
||||
M( 0, 0, 0), M(212, 0, 212), M(212, 0, 212), M(212, 0, 212),
|
||||
|
|
Loading…
Reference in New Issue