diff options
author | Max Horn | 2003-05-15 23:50:16 +0000 |
---|---|---|
committer | Max Horn | 2003-05-15 23:50:16 +0000 |
commit | 9018be6cb327dcb2508855cc46765cd829192af0 (patch) | |
tree | 2fea84f0cbeacb82621b79525d96d3b85604e0d4 /scumm/gfx.cpp | |
parent | 27c093a3a660fb259198961203d01a2694c8d414 (diff) | |
download | scummvm-rg350-9018be6cb327dcb2508855cc46765cd829192af0.tar.gz scummvm-rg350-9018be6cb327dcb2508855cc46765cd829192af0.tar.bz2 scummvm-rg350-9018be6cb327dcb2508855cc46765cd829192af0.zip |
moved drawBox to gfx.cpp (seems to be the more logical location)
svn-id: r7554
Diffstat (limited to 'scumm/gfx.cpp')
-rw-r--r-- | scumm/gfx.cpp | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/scumm/gfx.cpp b/scumm/gfx.cpp index 2ef7509dd3..4281dfe411 100644 --- a/scumm/gfx.cpp +++ b/scumm/gfx.cpp @@ -522,6 +522,67 @@ void Scumm::blit(byte *dst, byte *src, int w, int h) { } while (--h); } +void Scumm::drawBox(int x, int y, int x2, int y2, int color) { + int width, height; + VirtScreen *vs; + byte *backbuff, *bgbuff; + + if ((vs = findVirtScreen(y)) == NULL) + return; + + if (x > x2) + SWAP(x, x2); + + if (y > y2) + SWAP(y, y2); + + x2++; + y2++; + + // Adjust for the topline of the VirtScreen + y -= vs->topline; + y2 -= vs->topline; + + // Clip the coordinates + if (x < 0) + x = 0; + else if (x >= vs->width) + return; + + if (x2 < 0) + return; + else if (x2 > vs->width) + x2 = vs->width; + + if (y < 0) + y = 0; + else if (y > vs->height) + return; + + if (y2 < 0) + return; + else if (y2 > vs->height) + y2 = vs->height; + + updateDirtyRect(vs->number, x, x2, y, y2, 0); + + backbuff = vs->screenPtr + vs->xstart + y * _screenWidth + x; + + width = x2 - x; + height = y2 - y; + if (color == -1) { + if (vs->number != 0) + error("can only copy bg to main window"); + bgbuff = getResourceAddress(rtBuffer, vs->number + 5) + vs->xstart + y * _screenWidth + x; + blit(backbuff, bgbuff, width, height); + } else { + while (height--) { + memset(backbuff, color, width); + backbuff += _screenWidth; + } + } +} + #pragma mark - void Scumm::initBGBuffers(int height) { @@ -854,6 +915,10 @@ bool Scumm::isMaskActiveAt(int l, int t, int r, int b, byte *mem) { return false; } +#pragma mark - +#pragma mark --- Image drawing --- +#pragma mark - + void Gdi::drawBitmap(byte *ptr, VirtScreen *vs, int x, int y, const int width, const int height, int stripnr, int numstrip, byte flag) { assert(ptr); |