diff options
author | Stephen Kennedy | 2008-07-08 15:03:39 +0000 |
---|---|---|
committer | Stephen Kennedy | 2008-07-08 15:03:39 +0000 |
commit | d1bc01b1a9761cf1a45c99b22512b5c42cf3eb5b (patch) | |
tree | bb6ac2e5a7dcc3184128e59b06738ab841c0512b /graphics | |
parent | 641e3d752e9fc3b631474773a815b019f8d507e7 (diff) | |
download | scummvm-rg350-d1bc01b1a9761cf1a45c99b22512b5c42cf3eb5b.tar.gz scummvm-rg350-d1bc01b1a9761cf1a45c99b22512b5c42cf3eb5b.tar.bz2 scummvm-rg350-d1bc01b1a9761cf1a45c99b22512b5c42cf3eb5b.zip |
- Virtual keyboard now can now be dragged, when the user clicks on any part of it that is not a special area.
- Fixed non-virtual destructor warnings for Shape and Rect classes
svn-id: r32965
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/surface-keycolored.cpp | 26 | ||||
-rw-r--r-- | graphics/surface-keycolored.h | 2 |
2 files changed, 22 insertions, 6 deletions
diff --git a/graphics/surface-keycolored.cpp b/graphics/surface-keycolored.cpp index 79beb5d5b5..f533213fb6 100644 --- a/graphics/surface-keycolored.cpp +++ b/graphics/surface-keycolored.cpp @@ -2,22 +2,38 @@ namespace Graphics { -void SurfaceKeyColored::blit(Surface *surf_src, int16 x, int16 y, OverlayColor trans) { +void SurfaceKeyColored::blit(Surface *surf_src, int16 x, int16 y, OverlayColor transparent) { if (bytesPerPixel != sizeof(OverlayColor) || surf_src->bytesPerPixel != sizeof(OverlayColor)) return ; - OverlayColor *dst = (OverlayColor*) getBasePtr(x, y); const OverlayColor *src = (const OverlayColor*)surf_src->pixels; + int blitW = surf_src->w; + int blitH = surf_src->h; - int blitW = (surf_src->w + x > w) ? w - x : surf_src->w; - int blitH = (surf_src->h + y > h) ? h - y : surf_src->h; + // clip co-ordinates + if (x < 0) { + blitW += x; + src -= x; + x = 0; + } + if (y < 0) { + blitH += y; + src -= y * surf_src->w; + y = 0; + } + if (blitW > w - x) blitW = w - x; + if (blitH > h - y) blitH = h - y; + if (blitW <= 0 || blitH <= 0) + return; + + OverlayColor *dst = (OverlayColor*) getBasePtr(x, y); int dstAdd = w - blitW; int srcAdd = surf_src->w - blitW; for (int i = 0; i < blitH; ++i) { for (int j = 0; j < blitW; ++j, ++dst, ++src) { OverlayColor col = *src; - if (col != trans) + if (col != transparent) *dst = col; } dst += dstAdd; diff --git a/graphics/surface-keycolored.h b/graphics/surface-keycolored.h index d2788b204e..608bf7a482 100644 --- a/graphics/surface-keycolored.h +++ b/graphics/surface-keycolored.h @@ -8,7 +8,7 @@ namespace Graphics { struct SurfaceKeyColored : Surface { - void blit(Surface *surf_src, int16 x, int16 y, OverlayColor trans); + void blit(Surface *surf_src, int16 x, int16 y, OverlayColor transparent); }; |