diff options
author | tron <tron@openttd.org> | 2006-09-02 20:34:04 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-09-02 20:34:04 +0000 |
commit | e3d00af21eec2acdfb85716c7be0346f4bb7231b (patch) | |
tree | 70b19f3d23d0aa9b8e42aaf03b20cab4c2dd5191 | |
parent | ab523bb59f0c2c3beef6b7a87070a2c2a1e4d981 (diff) | |
download | openttd-e3d00af21eec2acdfb85716c7be0346f4bb7231b.tar.xz |
(svn r6346) -Codechange: Remove redundant assignment
-rw-r--r-- | gfx.c | 46 | ||||
-rw-r--r-- | screenshot.c | 2 | ||||
-rw-r--r-- | spritecache.c | 24 | ||||
-rw-r--r-- | viewport.c | 2 |
4 files changed, 69 insertions, 5 deletions
@@ -190,7 +190,7 @@ void GfxDrawLine(int x, int y, int x2, int y2, int color) // Check clipping first { - DrawPixelInfo *dpi = _cur_dpi; + const DrawPixelInfo *dpi = _cur_dpi; int t; if (x < dpi->left && x2 < dpi->left) return; @@ -560,7 +560,7 @@ int GetStringWidth(const char *str) int DoDrawString(const char *string, int x, int y, uint16 real_color) { - DrawPixelInfo *dpi = _cur_dpi; + const DrawPixelInfo *dpi = _cur_dpi; FontSize size = _cur_fontsize; byte c; byte color; @@ -753,6 +753,47 @@ static void GfxBlitTileZoomIn(BlitterParams *bp) break; default: +#if 0 + src = src_o; + do { + int offs = bp->start_x; + + dst = bp->dst; + for (src = src_o;; src += num + 2) { + skip = src[1]; + if (skip >= offs) { + dst += skip; + break; + } + offs -= skip; + + done = src[0]; + num = done & 0x7F; + if (num > offs) { + src += offs; + dst += offs; + num -= offs; + break; + } + } + + src += 2; + + for (;;) { + do { + *dst++ = *src++; + } while (--num != 0); + + if (done & 0x80) break; + + done = *src++; + num = done & 0x7F; + dst += *src++; + } + + bp->dst += bp->pitch; + } while (--bp->height != 0); +#else do { do { done = src_o[0]; @@ -794,6 +835,7 @@ static void GfxBlitTileZoomIn(BlitterParams *bp) bp->dst += bp->pitch; } while (--bp->height != 0); +#endif break; } } diff --git a/screenshot.c b/screenshot.c index 3c134cdcc..7fe4b2cbd 100644 --- a/screenshot.c +++ b/screenshot.c @@ -460,7 +460,7 @@ static void CurrentScreenCallback(void *userdata, Pixel *buf, uint y, uint pitch // generate a large piece of the world static void LargeWorldCallback(void *userdata, Pixel *buf, uint y, uint pitch, uint n) { - ViewPort *vp = (ViewPort *)userdata; + const ViewPort* vp = (const ViewPort*)userdata; DrawPixelInfo dpi, *old_dpi; int wx, left; diff --git a/spritecache.c b/spritecache.c index 4604f7602..f494e7db2 100644 --- a/spritecache.c +++ b/spritecache.c @@ -138,6 +138,30 @@ static void* ReadSprite(SpriteID id) } } +#if 1 + if (sprite->info & 8) { + byte* src = sprite->data + sprite->height * 2; + uint height = sprite->height; + + do { + uint offset; + uint len; + + offset = 0; + do { + uint skip; + + skip = src[1]; + src[1] = skip - offset; + offset = skip; + + len = src[0]; + src += (len & 0x7F) + 2; + } while (!(len & 0x80)); + } while (--height != 0); + } +#endif + return sprite; } } diff --git a/viewport.c b/viewport.c index 7dc46e4a6..1f522ab7a 100644 --- a/viewport.c +++ b/viewport.c @@ -1177,8 +1177,6 @@ static void ViewportDrawStrings(DrawPixelInfo *dpi, const StringSpriteToDraw *ss ss = ss->next; } while (ss != NULL); - - _cur_dpi = dpi; } void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom) |