diff options
| author | David Corrales | 2007-08-05 19:34:20 +0000 |
|---|---|---|
| committer | David Corrales | 2007-08-05 19:34:20 +0000 |
| commit | 6856535010bd2fa4449bcfde1c88dc06cd46e26f (patch) | |
| tree | b81a2234c2beff0312c93e039d6cafda4babeca6 /engines/touche/graphics.cpp | |
| parent | 1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7 (diff) | |
| parent | ec1803f838d5efc7decf75c05a1fb4a9633751e5 (diff) | |
| download | scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.gz scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.tar.bz2 scummvm-rg350-6856535010bd2fa4449bcfde1c88dc06cd46e26f.zip | |
Merged fsnode with trunk: r27971:28460
svn-id: r28462
Diffstat (limited to 'engines/touche/graphics.cpp')
| -rw-r--r-- | engines/touche/graphics.cpp | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/engines/touche/graphics.cpp b/engines/touche/graphics.cpp index 51fdcbd89a..2ca11a1f95 100644 --- a/engines/touche/graphics.cpp +++ b/engines/touche/graphics.cpp @@ -177,34 +177,58 @@ void Graphics::drawLine(uint8 *dst, int dstPitch, int x1, int y1, int x2, int y2 } void Graphics::copyRect(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, int flags) { - if (w != 0 && h != 0) { - dst += dstY * dstPitch + dstX; - src += srcY * srcPitch + srcX; - while (h--) { - for (int i = 0; i < w; ++i) { - if ((flags & kTransparent) == 0 || src[i] != 0) { - dst[i] = src[i]; - } + if (dstX < 0) { + w += dstX; + dstX = 0; + } + if (w <= 0) { + return; + } + if (dstY < 0) { + h += dstY; + dstY = 0; + } + if (h <= 0) { + return; + } + dst += dstY * dstPitch + dstX; + src += srcY * srcPitch + srcX; + while (h--) { + for (int i = 0; i < w; ++i) { + if ((flags & kTransparent) == 0 || src[i] != 0) { + dst[i] = src[i]; } - dst += dstPitch; - src += srcPitch; } + dst += dstPitch; + src += srcPitch; } } void Graphics::copyMask(uint8 *dst, int dstPitch, int dstX, int dstY, const uint8 *src, int srcPitch, int srcX, int srcY, int w, int h, uint8 fillColor) { - if (w != 0 && h != 0) { - dst += dstY * dstPitch + dstX; - src += srcY * srcPitch + srcX; - while (h--) { - for (int i = 0; i < w; ++i) { - if (src[i] != 0) { - dst[i] = fillColor; - } + if (dstX < 0) { + w += dstX; + dstX = 0; + } + if (w <= 0) { + return; + } + if (dstY < 0) { + h += dstY; + dstY = 0; + } + if (h <= 0) { + return; + } + dst += dstY * dstPitch + dstX; + src += srcY * srcPitch + srcX; + while (h--) { + for (int i = 0; i < w; ++i) { + if (src[i] != 0) { + dst[i] = fillColor; } - dst += dstPitch; - src += srcPitch; } + dst += dstPitch; + src += srcPitch; } } |
