Mercurial > hg > openttd
changeset 2025:f8a8dc5bdb1f draft
(svn r2534) Small cleanup
author | tron <tron@openttd.org> |
---|---|
date | Fri, 08 Jul 2005 21:24:27 +0000 |
parents | 7fff0f75d02b |
children | 480a107508f8 |
files | gfx.c table/palettes.h |
diffstat | 2 files changed, 60 insertions(+), 54 deletions(-) [+] |
line wrap: on
line diff
--- a/gfx.c +++ b/gfx.c @@ -451,7 +451,7 @@ byte color_3 = _color_list[ctab].window_color_bgb; byte color = _color_list[ctab].window_color_2; - if (!(flags & 0x8)) { + if (!(flags & 0x8)) { if (!(flags & 0x20)) { GfxFillRect(left, top, left, bottom - 1, color); GfxFillRect(left + 1, top, right - 1, top, color); @@ -1659,66 +1659,72 @@ 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 { - if (*b != 0) { - int left,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); + x = 0; + do { + if (*b != 0) { + int left; + int top; + int right = x + 64; + int bottom = y; + byte *p = b; + int h2; - // Try coalescing to the right too. - h2 = (bottom - y) >> 3; - assert(h2>0); - p = b; - - while (right != w) { - byte *p2 = ++p; - int h = h2; - // Check if a full line of dirty flags is set. + // First try coalescing downwards do { - if (!*p2) goto no_more_coalesc; - p2 += DIRTY_BYTES_PER_LINE; - } while (--h); + *p = 0; + p += DIRTY_BYTES_PER_LINE; + bottom += 8; + } while (bottom != h && *p != 0); + + // Try coalescing to the right too. + h2 = (bottom - y) >> 3; + assert(h2 > 0); + p = b; + + while (right != w) { + byte *p2 = ++p; + int h = h2; + // Check if a full line of dirty flags is set. + do { + if (!*p2) goto no_more_coalesc; + p2 += DIRTY_BYTES_PER_LINE; + } while (--h != 0); - // Wohoo, can combine it one step to the right! - // Do that, and clear the bits. - right += 64; + // Wohoo, can combine it one step to the right! + // Do that, and clear the bits. + right += 64; + + h = h2; + p2 = p; + do { + *p2 = 0; + p2 += DIRTY_BYTES_PER_LINE; + } while (--h != 0); + } + no_more_coalesc: - h = h2; - p2 = p; - do { - *p2 = 0; - p2 += DIRTY_BYTES_PER_LINE; - } while (--h); + left = x; + top = y; + + if (left < _invalid_rect.left ) left = _invalid_rect.left; + if (top < _invalid_rect.top ) top = _invalid_rect.top; + if (right > _invalid_rect.right ) right = _invalid_rect.right; + if (bottom > _invalid_rect.bottom) bottom = _invalid_rect.bottom; + + if (left < right && top < bottom) { + RedrawScreenRect(left, top, right, bottom); + } + } - no_more_coalesc:; - - left = x; - top = y; - - if (left < _invalid_rect.left)left = _invalid_rect.left; - if (top < _invalid_rect.top) top = _invalid_rect.top; - if (right > _invalid_rect.right)right = _invalid_rect.right; - if (bottom > _invalid_rect.bottom)bottom = _invalid_rect.bottom; - - if (left < right && top < bottom) { - RedrawScreenRect(left, top, right, bottom); - } - - } - } 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; @@ -1820,7 +1826,7 @@ if (cv->sprite == cursor) return; - p = GetSprite(cursor & 0x3FFF); + p = GetSprite(cursor & 0x3FFF); cv->sprite = cursor; cv->size.y = p->height; cv->size.x = p->width;