diff options
author | Max Horn | 2004-10-09 00:06:36 +0000 |
---|---|---|
committer | Max Horn | 2004-10-09 00:06:36 +0000 |
commit | b3c72a792bf2625f58c68822a1ca87a299318c87 (patch) | |
tree | 64d742b8a1a53d40995819ffe6877e526e804756 | |
parent | ca41dba220eceb2f2cca43126ee91ef9c86bae95 (diff) | |
download | scummvm-rg350-b3c72a792bf2625f58c68822a1ca87a299318c87.tar.gz scummvm-rg350-b3c72a792bf2625f58c68822a1ca87a299318c87.tar.bz2 scummvm-rg350-b3c72a792bf2625f58c68822a1ca87a299318c87.zip |
Fix for bug #1042802 (DIG: Graphics glitch when scrolling) -- the fix is to properly distinguish pitch and width of the target surface
svn-id: r15480
-rw-r--r-- | scumm/akos.cpp | 48 | ||||
-rw-r--r-- | scumm/base-costume.cpp | 7 | ||||
-rw-r--r-- | scumm/base-costume.h | 11 | ||||
-rw-r--r-- | scumm/costume.cpp | 42 |
4 files changed, 48 insertions, 60 deletions
diff --git a/scumm/akos.cpp b/scumm/akos.cpp index 285cd3320c..ef64113cc7 100644 --- a/scumm/akos.cpp +++ b/scumm/akos.cpp @@ -537,7 +537,7 @@ void AkosRenderer::codec1_genericDecode() { return; } } else { - masked = (y < 0 || y >= _outheight) || (*mask & maskbit); + masked = (y < 0 || y >= _out.h) || (*mask & maskbit); if (color && !masked && !skip_column) { pcolor = palette[color]; @@ -555,7 +555,7 @@ void AkosRenderer::codec1_genericDecode() { *dst = pcolor; } } - dst += _outwidth; + dst += _out.pitch; mask += _numStrips; y++; } @@ -569,7 +569,7 @@ void AkosRenderer::codec1_genericDecode() { if (_scaleX == 255 || v1.scaletable[v1.scaleXindex] < _scaleX) { v1.x += v1.scaleXstep; - if (v1.x < 0 || v1.x >= _outwidth) + if (v1.x < 0 || v1.x >= _out.w) return; maskbit = revBitMask[(v1.x + _vm->virtscr[0].xstart) & 7]; v1.destptr += v1.scaleXstep; @@ -802,7 +802,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { j = startScaleIndexX; for (i = 0; i < _width; i++) { - if (rect.left >= _outwidth) { + if (rect.left >= _out.w) { startScaleIndexX = j; skip++; } @@ -871,10 +871,10 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { } else _vm->markRectAsDirty(kMainVirtScreen, rect, _actorID); - if (rect.top >= _outheight || rect.bottom <= 0) + if (rect.top >= _out.h || rect.bottom <= 0) return 0; - if (rect.left >= _outwidth || rect.right <= 0) + if (rect.left >= _out.w || rect.right <= 0) return 0; v1.replen = 0; @@ -887,7 +887,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { codec1_ignorePakCols(skip); v1.x = 0; } else { - skip = rect.right - _outwidth; + skip = rect.right - _out.w; if (skip <= 0) { drawFlag = 2; } else { @@ -896,11 +896,11 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { } } else { if (!use_scaling) - skip = rect.right - _outwidth + 1; + skip = rect.right - _out.w + 1; if (skip > 0) { v1.skip_width -= skip; codec1_ignorePakCols(skip); - v1.x = _outwidth - 1; + v1.x = _out.w - 1; } else { skip = -1 - rect.left; if (skip <= 0) @@ -919,18 +919,18 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) { if (rect.top < 0) rect.top = 0; - if (rect.top > _outheight) - rect.top = _outheight; + if (rect.top > _out.h) + rect.top = _out.h; - if (rect.bottom > _outheight) - rect.bottom = _outheight; + if (rect.bottom > _out.h) + rect.bottom = _out.h; if (_draw_top > rect.top) _draw_top = rect.top; if (_draw_bottom < rect.bottom) _draw_bottom = rect.bottom; - v1.destptr = _outptr + v1.y * _outwidth + v1.x; + v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x; codec1_genericDecode(); @@ -956,8 +956,8 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) { clip.top = _actorY + ymoveCur; clip.right = clip.left + _width; clip.bottom = clip.top + _height; - maxw = _outwidth; - maxh = _outheight; + maxw = _out.w; + maxh = _out.h; _vm->markRectAsDirty(kMainVirtScreen, clip, _actorID); @@ -976,7 +976,7 @@ byte AkosRenderer::codec5(int xmoveCur, int ymoveCur) { bdd.srcwidth = _width; bdd.srcheight = _height; bdd.dst = _vm->virtscr[kMainVirtScreen]; - bdd.dst.pixels = _outptr; + bdd.dst.pixels = _out.pixels; bdd.dataptr = _srcptr; bdd.scale_x = 255; bdd.scale_y = 255; @@ -1124,8 +1124,8 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) { clip.top = _actorY + ymoveCur; clip.right = clip.left + _width; clip.bottom = clip.top + _height; - maxw = _outwidth; - maxh = _outheight; + maxw = _out.w; + maxh = _out.h; if (_vm->_heversion >= 71) { clip.clip(_clipOverride); @@ -1169,8 +1169,6 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) { int32 width_unk, height_unk; height_unk = clip.top; - int32 pitch = _outwidth; - int32 dir; if (!_mirror) { @@ -1202,9 +1200,9 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) { int32 numskip_before = skip_x + (skip_y * _width); int32 numskip_after = _width - cur_x; - byte *dst = _outptr + width_unk + height_unk * _outwidth; + byte *dst = (byte *)_out.pixels + width_unk + height_unk * _out.pitch; - akos16Decompress(dst, pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf); + akos16Decompress(dst, _out.pitch, _srcptr, cur_x, out_height, dir, numskip_before, numskip_after, transparency, clip.left, clip.top, _zbuf); return 0; } @@ -1232,11 +1230,11 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) { if (_draw_bottom < dst.bottom) _draw_bottom = dst.bottom; - byte *dstPtr = _outptr + dst.left + dst.top * _outwidth; + byte *dstPtr = (byte *)_out.pixels + dst.left + dst.top * _out.pitch; for (int i = 0; i < 256; i++) _vm->gdi._wizImagePalette[i] = i; - _vm->gdi.decompressWizImage(dstPtr, _outwidth, dst, _srcptr, src); + _vm->gdi.decompressWizImage(dstPtr, _out.pitch, dst, _srcptr, src); return 0; } diff --git a/scumm/base-costume.cpp b/scumm/base-costume.cpp index f4d2b28f87..386c260de3 100644 --- a/scumm/base-costume.cpp +++ b/scumm/base-costume.cpp @@ -29,13 +29,12 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const int i; byte result = 0; + _out = vs; if (drawToBackBuf) - _outptr = vs.getBackPixels(0, 0); + _out.pixels = vs.getBackPixels(0, 0); else - _outptr = vs.getPixels(0, 0); + _out.pixels = vs.getPixels(0, 0); - _outwidth = vs.pitch; - _outheight = vs.h; _numStrips = numStrips; if (_vm->_version == 1) { diff --git a/scumm/base-costume.h b/scumm/base-costume.h index c32dab3c3f..1ad9f3f5c8 100644 --- a/scumm/base-costume.h +++ b/scumm/base-costume.h @@ -71,8 +71,7 @@ protected: ScummEngine *_vm; // Destination - byte *_outptr; - int _outwidth, _outheight; + Graphics::Surface _out; int32 _numStrips; // Source pointer @@ -119,14 +118,6 @@ public: _width = _height = 0; _skipLimb = 0; _transparency = 0; - - _clipOverride.right = 0; - _clipOverride.left = 0; - _clipOverride.top = 0; - _clipOverride.bottom = 0; - - _outptr = 0; - _outwidth = _outheight = 0; } virtual void setPalette(byte *palette) = 0; diff --git a/scumm/costume.cpp b/scumm/costume.cpp index 0a789755b9..5e1dcebd5b 100644 --- a/scumm/costume.cpp +++ b/scumm/costume.cpp @@ -157,7 +157,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { _scaleIndexX = startScaleIndexX; for (i = 0; i < _width; i++) { - if (rect.left >= _outwidth) { + if (rect.left >= _out.w) { startScaleIndexX = _scaleIndexX; skip++; } @@ -219,10 +219,10 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { else _vm->markRectAsDirty(kMainVirtScreen, rect.left, rect.right + 1, rect.top, rect.bottom, _actorID); - if (rect.top >= _outheight || rect.bottom <= 0) + if (rect.top >= _out.h || rect.bottom <= 0) return 0; - if (rect.left >= _outwidth || rect.right <= 0) + if (rect.left >= _out.w || rect.right <= 0) return 0; v1.replen = 0; @@ -237,7 +237,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { v1.x = 0; } } else { - skip = rect.right - _outwidth; + skip = rect.right - _out.w; if (skip <= 0) { drawFlag = 2; } else { @@ -246,12 +246,12 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { } } else { if (!use_scaling) - skip = rect.right - _outwidth; + skip = rect.right - _out.w; if (skip > 0) { if (!newAmiCost && _loaded._format != 0x57) { v1.skip_width -= skip; codec1_ignorePakCols(skip); - v1.x = _outwidth - 1; + v1.x = _out.w - 1; } } else { // V1 games uses 8 x 8 pixels for actors @@ -275,11 +275,11 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { if (rect.top < 0) rect.top = 0; - if (rect.top > _outheight) - rect.top = _outheight; + if (rect.top > _out.h) + rect.top = _out.h; - if (rect.bottom > _outheight) - rect.bottom = _outheight; + if (rect.bottom > _out.h) + rect.bottom = _out.h; if (_draw_top > rect.top) _draw_top = rect.top; @@ -291,7 +291,7 @@ byte CostumeRenderer::mainRoutine(int xmoveCur, int ymoveCur) { return 2; } - v1.destptr = _outptr + v1.y * _outwidth + v1.x; + v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x; v1.mask_ptr = _vm->getMaskBuffer(0, v1.y, _zbuf); @@ -374,14 +374,14 @@ void CostumeRenderer::procC64(int actor) { if (!rep) color = *src++; - if (0 <= y && y < _outheight && 0 <= v1.x && v1.x < _outwidth) { + if (0 <= y && y < _out.h && 0 <= v1.x && v1.x < _out.w) { if (!_mirror) { LINE(0, 0); LINE(2, 2); LINE(4, 4); LINE(6, 6); } else { LINE(6, 0); LINE(4, 2); LINE(2, 4); LINE(0, 6); } } - dst += _outwidth; + dst += _out.pitch; y++; mask += _numStrips; if (!--height) { @@ -390,7 +390,7 @@ void CostumeRenderer::procC64(int actor) { height = _height; y = v1.y; v1.x += 8 * v1.scaleXstep; - if (v1.x < 0 || v1.x >= _outwidth) + if (v1.x < 0 || v1.x >= _out.w) return; mask = v1.mask_ptr; v1.destptr += 8 * v1.scaleXstep; @@ -455,7 +455,7 @@ void CostumeRenderer::proc3() { do { if (_scaleY == 255 || *scaleytab++ < _scaleY) { - masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && (mask[0] & maskbit)); + masked = (y < 0 || y >= _out.h) || (v1.mask_ptr && (mask[0] & maskbit)); if (color && !masked) { // FIXME: Fully implement _shadow_mode.in Sam & Max @@ -469,7 +469,7 @@ void CostumeRenderer::proc3() { } *dst = pcolor; } - dst += _outwidth; + dst += _out.pitch; mask += _numStrips; y++; } @@ -483,7 +483,7 @@ void CostumeRenderer::proc3() { if (_scaleX == 255 || v1.scaletable[_scaleIndexX] < _scaleX) { v1.x += v1.scaleXstep; - if (v1.x < 0 || v1.x >= _outwidth) + if (v1.x < 0 || v1.x >= _out.w) return; maskbit = revBitMask[v1.x & 7]; v1.destptr += v1.scaleXstep; @@ -524,9 +524,9 @@ void CostumeRenderer::proc3_ami() { len = *src++; do { if (_scaleY == 255 || v1.scaletable[_scaleIndexY] < _scaleY) { - masked = (y < 0 || y >= _outheight) || (v1.mask_ptr && (mask[0] & maskbit)); + masked = (y < 0 || y >= _out.h) || (v1.mask_ptr && (mask[0] & maskbit)); - if (color && v1.x >= 0 && v1.x < _outwidth && !masked) { + if (color && v1.x >= 0 && v1.x < _out.w && !masked) { *dst = _palette[color]; } @@ -542,11 +542,11 @@ void CostumeRenderer::proc3_ami() { if (!--height) return; - if (y >= _outheight) + if (y >= _out.h) return; if (v1.x != oldXpos) { - dst += _outwidth - (v1.x - oldXpos); + dst += _out.pitch - (v1.x - oldXpos); v1.mask_ptr += _numStrips; mask = v1.mask_ptr; y++; |