SCUMM: Rename _bitDepth to _bytesPerPixel

svn-id: r44336
This commit is contained in:
Max Horn 2009-09-25 09:13:33 +00:00
parent 07092bfccb
commit adaf3ec8b4
11 changed files with 62 additions and 62 deletions

View file

@ -2451,7 +2451,7 @@ void ScummEngine_v71he::postProcessAuxQueue() {
uint8 *dst2 = pvs->getBackPixels(0, pvs->topline); uint8 *dst2 = pvs->getBackPixels(0, pvs->topline);
switch (comp) { switch (comp) {
case 1: case 1:
Wiz::copyAuxImage(dst1, dst2, axfd + 10, pvs->pitch, pvs->h, x, y, w, h, _bitDepth); Wiz::copyAuxImage(dst1, dst2, axfd + 10, pvs->pitch, pvs->h, x, y, w, h, _bytesPerPixel);
break; break;
default: default:
error("unimplemented compression type %d", comp); error("unimplemented compression type %d", comp);

View file

@ -602,7 +602,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
pcolor = _shadow_table[pcolor]; pcolor = _shadow_table[pcolor];
} }
} }
if (_vm->_bitDepth == 2) { if (_vm->_bytesPerPixel == 2) {
WRITE_UINT16(dst, pcolor); WRITE_UINT16(dst, pcolor);
} else { } else {
*dst = pcolor; *dst = pcolor;
@ -626,7 +626,7 @@ void AkosRenderer::codec1_genericDecode(Codec1 &v1) {
if (v1.x < 0 || v1.x >= v1.boundsRect.right) if (v1.x < 0 || v1.x >= v1.boundsRect.right)
return; return;
maskbit = revBitMask(v1.x & 7); maskbit = revBitMask(v1.x & 7);
v1.destptr += v1.scaleXstep * _vm->_bitDepth; v1.destptr += v1.scaleXstep * _vm->_bytesPerPixel;
skip_column = false; skip_column = false;
} else } else
skip_column = true; skip_column = true;
@ -996,7 +996,7 @@ byte AkosRenderer::codec1(int xmoveCur, int ymoveCur) {
if (_draw_bottom < rect.bottom) if (_draw_bottom < rect.bottom)
_draw_bottom = rect.bottom; _draw_bottom = rect.bottom;
v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x * _vm->_bitDepth; v1.destptr = (byte *)_out.pixels + v1.y * _out.pitch + v1.x * _vm->_bytesPerPixel;
codec1_genericDecode(v1); codec1_genericDecode(v1);
@ -1190,7 +1190,7 @@ void AkosRenderer::akos16Decompress(byte *dest, int32 pitch, const byte *src, in
} }
byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) { byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
assert(_vm->_bitDepth == 1); assert(_vm->_bytesPerPixel == 1);
Common::Rect clip; Common::Rect clip;
int32 minx, miny, maxw, maxh; int32 minx, miny, maxw, maxh;
@ -1294,7 +1294,7 @@ byte AkosRenderer::codec16(int xmoveCur, int ymoveCur) {
int32 numskip_before = skip_x + (skip_y * _width); int32 numskip_before = skip_x + (skip_y * _width);
int32 numskip_after = _width - cur_x; int32 numskip_after = _width - cur_x;
byte *dst = (byte *)_out.pixels + height_unk * _out.pitch + width_unk * _vm->_bitDepth; byte *dst = (byte *)_out.pixels + height_unk * _out.pitch + width_unk * _vm->_bytesPerPixel;
akos16Decompress(dst, _out.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; return 0;
@ -1364,14 +1364,14 @@ byte AkosRenderer::codec32(int xmoveCur, int ymoveCur) {
palPtr = _vm->_hePalettes + _vm->_hePaletteSlot + 768; palPtr = _vm->_hePalettes + _vm->_hePaletteSlot + 768;
} }
byte *dstPtr = (byte *)_out.pixels + dst.top * _out.pitch + dst.left * _vm->_bitDepth; byte *dstPtr = (byte *)_out.pixels + dst.top * _out.pitch + dst.left * _vm->_bytesPerPixel;
if (_shadow_mode == 3) { if (_shadow_mode == 3) {
Wiz::decompressWizImage<kWizXMap>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, xmap, _vm->_bitDepth); Wiz::decompressWizImage<kWizXMap>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, xmap, _vm->_bytesPerPixel);
} else { } else {
if (palPtr != NULL) { if (palPtr != NULL) {
Wiz::decompressWizImage<kWizRMap>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, NULL, _vm->_bitDepth); Wiz::decompressWizImage<kWizRMap>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, palPtr, NULL, _vm->_bytesPerPixel);
} else { } else {
Wiz::decompressWizImage<kWizCopy>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, NULL, NULL, _vm->_bitDepth); Wiz::decompressWizImage<kWizCopy>(dstPtr, _out.pitch, kDstScreen, _srcptr, src, 0, NULL, NULL, _vm->_bytesPerPixel);
} }
} }
#endif #endif

View file

@ -40,7 +40,7 @@ byte BaseCostumeRenderer::drawCostume(const VirtScreen &vs, int numStrips, const
_out.pixels = vs.getPixels(0, 0); _out.pixels = vs.getPixels(0, 0);
_actorX += _vm->_virtscr[kMainVirtScreen].xstart & 7; _actorX += _vm->_virtscr[kMainVirtScreen].xstart & 7;
_out.w = _out.pitch / _vm->_bitDepth; _out.w = _out.pitch / _vm->_bytesPerPixel;
_out.pixels = (byte *)_out.pixels - (_vm->_virtscr[kMainVirtScreen].xstart & 7); _out.pixels = (byte *)_out.pixels - (_vm->_virtscr[kMainVirtScreen].xstart & 7);
_numStrips = numStrips; _numStrips = numStrips;

View file

@ -284,7 +284,7 @@ CharsetRenderer::~CharsetRenderer() {
} }
CharsetRendererCommon::CharsetRendererCommon(ScummEngine *vm) CharsetRendererCommon::CharsetRendererCommon(ScummEngine *vm)
: CharsetRenderer(vm), _bitDepth(0), _fontHeight(0), _numChars(0) { : CharsetRenderer(vm), _bytesPerPixel(0), _fontHeight(0), _numChars(0) {
_shadowMode = kNoShadowMode; _shadowMode = kNoShadowMode;
_shadowColor = 0; _shadowColor = 0;
} }
@ -306,7 +306,7 @@ void CharsetRendererCommon::setCurID(int32 id) {
else else
_fontPtr += 29; _fontPtr += 29;
_bitDepth = _fontPtr[0]; _bytesPerPixel = _fontPtr[0];
_fontHeight = _fontPtr[1]; _fontHeight = _fontPtr[1];
_numChars = READ_LE_UINT16(_fontPtr + 2); _numChars = READ_LE_UINT16(_fontPtr + 2);
} }
@ -323,7 +323,7 @@ void CharsetRendererV3::setCurID(int32 id) {
if (_fontPtr == 0) if (_fontPtr == 0)
error("CharsetRendererCommon::setCurID: charset %d not found", id); error("CharsetRendererCommon::setCurID: charset %d not found", id);
_bitDepth = 1; _bytesPerPixel = 1;
_numChars = _fontPtr[4]; _numChars = _fontPtr[4];
_fontHeight = _fontPtr[5]; _fontHeight = _fontPtr[5];
@ -802,7 +802,7 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr,
byte *back = NULL; byte *back = NULL;
int drawTop = _top - vs->topline; int drawTop = _top - vs->topline;
if ((_vm->_game.heversion >= 71 && _bitDepth >= 8) || (_vm->_game.heversion >= 90 && _bitDepth == 0)) { if ((_vm->_game.heversion >= 71 && _bytesPerPixel >= 8) || (_vm->_game.heversion >= 90 && _bytesPerPixel == 0)) {
#ifdef ENABLE_HE #ifdef ENABLE_HE
if (ignoreCharsetMask || !vs->hasTwoBuffers) { if (ignoreCharsetMask || !vs->hasTwoBuffers) {
dstPtr = vs->getPixels(0, 0); dstPtr = vs->getPixels(0, 0);
@ -815,13 +815,13 @@ void CharsetRendererClassic::printCharIntern(bool is2byte, const byte *charPtr,
} }
Common::Rect rScreen(vs->w, vs->h); Common::Rect rScreen(vs->w, vs->h);
if (_bitDepth >= 8) { if (_bytesPerPixel >= 8) {
byte imagePalette[256]; byte imagePalette[256];
memset(imagePalette, 0, sizeof(imagePalette)); memset(imagePalette, 0, sizeof(imagePalette));
memcpy(imagePalette, _vm->_charsetColorMap, 4); memcpy(imagePalette, _vm->_charsetColorMap, 4);
Wiz::copyWizImage(dstPtr, charPtr, vs->pitch, kDstScreen, vs->w, vs->h, _left, _top, origWidth, origHeight, &rScreen, 0, imagePalette, NULL, _vm->_bitDepth); Wiz::copyWizImage(dstPtr, charPtr, vs->pitch, kDstScreen, vs->w, vs->h, _left, _top, origWidth, origHeight, &rScreen, 0, imagePalette, NULL, _vm->_bytesPerPixel);
} else { } else {
Wiz::copyWizImage(dstPtr, charPtr, vs->pitch, kDstScreen, vs->w, vs->h, _left, _top, origWidth, origHeight, &rScreen, 0, NULL, NULL, _vm->_bitDepth); Wiz::copyWizImage(dstPtr, charPtr, vs->pitch, kDstScreen, vs->w, vs->h, _left, _top, origWidth, origHeight, &rScreen, 0, NULL, NULL, _vm->_bytesPerPixel);
} }
if (_blitAlso && vs->hasTwoBuffers) { if (_blitAlso && vs->hasTwoBuffers) {

View file

@ -95,7 +95,7 @@ public:
class CharsetRendererCommon : public CharsetRenderer { class CharsetRendererCommon : public CharsetRenderer {
protected: protected:
const byte *_fontPtr; const byte *_fontPtr;
int _bitDepth; int _bytesPerPixel;
int _fontHeight; int _fontHeight;
int _numChars; int _numChars;

View file

@ -147,7 +147,7 @@ void ScummEngine::setCursorFromBuffer(const byte *ptr, int width, int height, in
uint size; uint size;
byte *dst; byte *dst;
size = width * height * _bitDepth; size = width * height * _bytesPerPixel;
if (size > sizeof(_grabbedCursor)) if (size > sizeof(_grabbedCursor))
error("grabCursor: grabbed cursor too big"); error("grabCursor: grabbed cursor too big");
@ -157,8 +157,8 @@ void ScummEngine::setCursorFromBuffer(const byte *ptr, int width, int height, in
dst = _grabbedCursor; dst = _grabbedCursor;
for (; height; height--) { for (; height; height--) {
memcpy(dst, ptr, width * _bitDepth); memcpy(dst, ptr, width * _bytesPerPixel);
dst += width * _bitDepth; dst += width * _bytesPerPixel;
ptr += pitch; ptr += pitch;
} }
@ -176,7 +176,7 @@ void ScummEngine_v70he::setDefaultCursor() {
0xff, 0xff, 0xff, 0, 0xff, 0xff, 0xff, 0,
0, 0, 0, 0}; 0, 0, 0, 0};
if (_bitDepth == 2) { if (_bytesPerPixel == 2) {
for (i = 0; i < 1024; i++) for (i = 0; i < 1024; i++)
WRITE_UINT16(_grabbedCursor + i * 2, 5); WRITE_UINT16(_grabbedCursor + i * 2, 5);
} else { } else {
@ -194,13 +194,13 @@ void ScummEngine_v70he::setDefaultCursor() {
for (j = 0; j < 32; j++) { for (j = 0; j < 32; j++) {
switch ((p & (0x3 << 14)) >> 14) { switch ((p & (0x3 << 14)) >> 14) {
case 1: case 1:
if (_bitDepth == 2) if (_bytesPerPixel == 2)
WRITE_UINT16(_grabbedCursor + 64 * i + j * 2, get16BitColor(palette[4], palette[5], palette[6])); WRITE_UINT16(_grabbedCursor + 64 * i + j * 2, get16BitColor(palette[4], palette[5], palette[6]));
else else
_grabbedCursor[32 * i + j] = 0xfe; _grabbedCursor[32 * i + j] = 0xfe;
break; break;
case 2: case 2:
if (_bitDepth == 2) if (_bytesPerPixel == 2)
WRITE_UINT16(_grabbedCursor + 64 * i + j * 2, get16BitColor(palette[0], palette[1], palette[2])); WRITE_UINT16(_grabbedCursor + 64 * i + j * 2, get16BitColor(palette[0], palette[1], palette[2]));
else else
_grabbedCursor[32 * i + j] = 0xfd; _grabbedCursor[32 * i + j] = 0xfd;
@ -215,7 +215,7 @@ void ScummEngine_v70he::setDefaultCursor() {
} }
} }
if (_bitDepth == 1) { if (_bytesPerPixel == 1) {
// Since white color position is not guaranteed // Since white color position is not guaranteed
// we setup our own palette if supported by backend // we setup our own palette if supported by backend
CursorMan.replaceCursorPalette(palette, 0xfd, 3); CursorMan.replaceCursorPalette(palette, 0xfd, 3);

View file

@ -619,7 +619,7 @@ void ScummEngine::drawStripToScreen(VirtScreen *vs, int x, int width, int top, i
vsPitch >>= 2; vsPitch >>= 2;
if (_bitDepth == 2) { if (_bytesPerPixel == 2) {
// Sprites always seem to be used for subtitles in 16Bit color HE games, and not // Sprites always seem to be used for subtitles in 16Bit color HE games, and not
// the charset renderer, so charset masking isn't required. // the charset renderer, so charset masking isn't required.
for (int h = height * m; h > 0; --h) { for (int h = height * m; h > 0; --h) {
@ -1975,12 +1975,12 @@ void Gdi::drawBMAPObject(const byte *ptr, VirtScreen *vs, int obj, int x, int y,
assert(bmap_ptr); assert(bmap_ptr);
byte code = *bmap_ptr++; byte code = *bmap_ptr++;
int scrX = _vm->_screenStartStrip * 8 * _vm->_bitDepth; int scrX = _vm->_screenStartStrip * 8 * _vm->_bytesPerPixel;
if (code == 8 || code == 9) { if (code == 8 || code == 9) {
Common::Rect rScreen(0, 0, vs->w, vs->h); Common::Rect rScreen(0, 0, vs->w, vs->h);
byte *dst = (byte *)_vm->_virtscr[kMainVirtScreen].backBuf + scrX; byte *dst = (byte *)_vm->_virtscr[kMainVirtScreen].backBuf + scrX;
Wiz::copyWizImage(dst, bmap_ptr, vs->pitch, kDstScreen, vs->w, vs->h, x - scrX, y, w, h, &rScreen, 0, 0, 0, _vm->_bitDepth); Wiz::copyWizImage(dst, bmap_ptr, vs->pitch, kDstScreen, vs->w, vs->h, x - scrX, y, w, h, &rScreen, 0, 0, 0, _vm->_bytesPerPixel);
} }
Common::Rect rect1(x, y, x + w, y + h); Common::Rect rect1(x, y, x + w, y + h);
@ -2820,11 +2820,11 @@ void Gdi::drawStripHE(byte *dst, int dstPitch, const byte *src, int width, int h
while (1) { while (1) {
if (!transpCheck || color != _transparentColor) if (!transpCheck || color != _transparentColor)
writeRoomColor(dst, color); writeRoomColor(dst, color);
dst += _vm->_bitDepth; dst += _vm->_bytesPerPixel;
--x; --x;
if (x == 0) { if (x == 0) {
x = width; x = width;
dst += dstPitch - width * _vm->_bitDepth; dst += dstPitch - width * _vm->_bytesPerPixel;
--height; --height;
if (height == 0) if (height == 0)
return; return;
@ -2909,7 +2909,7 @@ void Gdi::drawStripComplex(byte *dst, int dstPitch, const byte *src, int height,
FILL_BITS; FILL_BITS;
if (!transpCheck || color != _transparentColor) if (!transpCheck || color != _transparentColor)
writeRoomColor(dst, color); writeRoomColor(dst, color);
dst += _vm->_bitDepth; dst += _vm->_bytesPerPixel;
againPos: againPos:
if (!READ_BIT) { if (!READ_BIT) {
@ -2930,13 +2930,13 @@ void Gdi::drawStripComplex(byte *dst, int dstPitch, const byte *src, int height,
do { do {
if (!--x) { if (!--x) {
x = 8; x = 8;
dst += dstPitch - 8 * _vm->_bitDepth; dst += dstPitch - 8 * _vm->_bytesPerPixel;
if (!--height) if (!--height)
return; return;
} }
if (!transpCheck || color != _transparentColor) if (!transpCheck || color != _transparentColor)
writeRoomColor(dst, color); writeRoomColor(dst, color);
dst += _vm->_bitDepth; dst += _vm->_bytesPerPixel;
} while (--reps); } while (--reps);
bits >>= 8; bits >>= 8;
bits |= (*src++) << (cl - 8); bits |= (*src++) << (cl - 8);
@ -2944,7 +2944,7 @@ void Gdi::drawStripComplex(byte *dst, int dstPitch, const byte *src, int height,
} }
} }
} while (--x); } while (--x);
dst += dstPitch - 8 * _vm->_bitDepth; dst += dstPitch - 8 * _vm->_bytesPerPixel;
} while (--height); } while (--height);
} }
@ -2961,7 +2961,7 @@ void Gdi::drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height,
FILL_BITS; FILL_BITS;
if (!transpCheck || color != _transparentColor) if (!transpCheck || color != _transparentColor)
writeRoomColor(dst, color); writeRoomColor(dst, color);
dst += _vm->_bitDepth; dst += _vm->_bytesPerPixel;
if (!READ_BIT) { if (!READ_BIT) {
} else if (!READ_BIT) { } else if (!READ_BIT) {
FILL_BITS; FILL_BITS;
@ -2976,7 +2976,7 @@ void Gdi::drawStripBasicH(byte *dst, int dstPitch, const byte *src, int height,
color += inc; color += inc;
} }
} while (--x); } while (--x);
dst += dstPitch - 8 * _vm->_bitDepth; dst += dstPitch - 8 * _vm->_bytesPerPixel;
} while (--height); } while (--height);
} }
@ -3061,7 +3061,7 @@ void Gdi::drawStripRaw(byte *dst, int dstPitch, const byte *src, int height, con
for (x = 0; x < 8; x ++) { for (x = 0; x < 8; x ++) {
byte color = *src++; byte color = *src++;
if (!transpCheck || color != _transparentColor) if (!transpCheck || color != _transparentColor)
writeRoomColor(dst + x * _vm->_bitDepth, color); writeRoomColor(dst + x * _vm->_bytesPerPixel, color);
} }
dst += dstPitch; dst += dstPitch;
} while (--height); } while (--height);

View file

@ -115,7 +115,7 @@ void MoviePlayer::handleNextFrame() {
assert(dstPtr); assert(dstPtr);
uint8 *dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0); uint8 *dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
assert(dst); assert(dst);
copyFrameToBuffer(dst, kDstResource, 0, 0, _vm->_screenWidth * _vm->_bitDepth); copyFrameToBuffer(dst, kDstResource, 0, 0, _vm->_screenWidth * _vm->_bytesPerPixel);
} else if (_flags & 1) { } else if (_flags & 1) {
copyFrameToBuffer(pvs->getBackPixels(0, 0), kDstScreen, 0, 0, pvs->pitch); copyFrameToBuffer(pvs->getBackPixels(0, 0), kDstScreen, 0, 0, pvs->pitch);

View file

@ -1498,10 +1498,10 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
int32 dstPitch, dstType, cw, ch; int32 dstPitch, dstType, cw, ch;
if (flags & kWIFBlitToMemBuffer) { if (flags & kWIFBlitToMemBuffer) {
dst = (uint8 *)malloc(width * height * _vm->_bitDepth); dst = (uint8 *)malloc(width * height * _vm->_bytesPerPixel);
int transColor = (_vm->VAR_WIZ_TCOLOR != 0xFF) ? (_vm->VAR(_vm->VAR_WIZ_TCOLOR)) : 5; int transColor = (_vm->VAR_WIZ_TCOLOR != 0xFF) ? (_vm->VAR(_vm->VAR_WIZ_TCOLOR)) : 5;
if (_vm->_bitDepth == 2) { if (_vm->_bytesPerPixel == 2) {
uint8 *tmpPtr = dst; uint8 *tmpPtr = dst;
for (uint i = 0; i < height; i++) { for (uint i = 0; i < height; i++) {
for (uint j = 0; j < width; j++) { for (uint j = 0; j < width; j++) {
@ -1518,7 +1518,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
} }
cw = width; cw = width;
ch = height; ch = height;
dstPitch = cw * _vm->_bitDepth; dstPitch = cw * _vm->_bytesPerPixel;
dstType = kDstMemory; dstType = kDstMemory;
} else { } else {
if (dstResNum) { if (dstResNum) {
@ -1527,7 +1527,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0); dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
assert(dst); assert(dst);
getWizImageDim(dstResNum, 0, cw, ch); getWizImageDim(dstResNum, 0, cw, ch);
dstPitch = cw * _vm->_bitDepth; dstPitch = cw * _vm->_bytesPerPixel;
dstType = kDstResource; dstType = kDstResource;
} else { } else {
VirtScreen *pvs = &_vm->_virtscr[kMainVirtScreen]; VirtScreen *pvs = &_vm->_virtscr[kMainVirtScreen];
@ -1559,7 +1559,7 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
} }
} }
if (flags & kWIFRemapPalette && _vm->_bitDepth == 1) { if (flags & kWIFRemapPalette && _vm->_bytesPerPixel == 1) {
palPtr = rmap + 4; palPtr = rmap + 4;
} }
@ -1571,19 +1571,19 @@ uint8 *Wiz::drawWizImage(int resNum, int state, int maskNum, int maskState, int
switch (comp) { switch (comp) {
case 0: case 0:
copyRawWizImage(dst, wizd, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, transColor, _vm->_bitDepth); copyRawWizImage(dst, wizd, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, transColor, _vm->_bytesPerPixel);
break; break;
case 1: case 1:
if (flags & 0x80) { if (flags & 0x80) {
dst = _vm->getMaskBuffer(0, 0, 1); dst = _vm->getMaskBuffer(0, 0, 1);
dstPitch /= _vm->_bitDepth; dstPitch /= _vm->_bytesPerPixel;
copyWizImageWithMask(dst, wizd, dstPitch, cw, ch, x1, y1, width, height, &rScreen, 0, 2); copyWizImageWithMask(dst, wizd, dstPitch, cw, ch, x1, y1, width, height, &rScreen, 0, 2);
} else if (flags & 0x100) { } else if (flags & 0x100) {
dst = _vm->getMaskBuffer(0, 0, 1); dst = _vm->getMaskBuffer(0, 0, 1);
dstPitch /= _vm->_bitDepth; dstPitch /= _vm->_bytesPerPixel;
copyWizImageWithMask(dst, wizd, dstPitch, cw, ch, x1, y1, width, height, &rScreen, 0, 1); copyWizImageWithMask(dst, wizd, dstPitch, cw, ch, x1, y1, width, height, &rScreen, 0, 1);
} else { } else {
copyWizImage(dst, wizd, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, xmapPtr, _vm->_bitDepth); copyWizImage(dst, wizd, dstPitch, dstType, cw, ch, x1, y1, width, height, &rScreen, flags, palPtr, xmapPtr, _vm->_bytesPerPixel);
} }
break; break;
#ifdef USE_RGB_COLOR #ifdef USE_RGB_COLOR
@ -1747,12 +1747,12 @@ void Wiz::captureWizPolygon(int resNum, int maskNum, int maskState, int id1, int
dstw = wp->bound.width(); dstw = wp->bound.width();
dsth = wp->bound.height(); dsth = wp->bound.height();
dstpitch = dstw * _vm->_bitDepth; dstpitch = dstw * _vm->_bytesPerPixel;
imageBuffer = (uint8 *)malloc(dstw * dsth * _vm->_bitDepth); imageBuffer = (uint8 *)malloc(dstw * dsth * _vm->_bytesPerPixel);
assert(imageBuffer); assert(imageBuffer);
const uint16 transColor = (_vm->VAR_WIZ_TCOLOR != 0xFF) ? _vm->VAR(_vm->VAR_WIZ_TCOLOR) : 5; const uint16 transColor = (_vm->VAR_WIZ_TCOLOR != 0xFF) ? _vm->VAR(_vm->VAR_WIZ_TCOLOR) : 5;
if (_vm->_bitDepth == 2) { if (_vm->_bytesPerPixel == 2) {
uint8 *tmpPtr = imageBuffer; uint8 *tmpPtr = imageBuffer;
for (i = 0; i < dsth; i++) { for (i = 0; i < dsth; i++) {
for (j = 0; j < dstw; j++) for (j = 0; j < dstw; j++)
@ -1764,7 +1764,7 @@ void Wiz::captureWizPolygon(int resNum, int maskNum, int maskState, int id1, int
} }
Common::Rect bound; Common::Rect bound;
drawWizPolygonImage(imageBuffer, src, NULL, dstpitch, kDstMemory, dstw, dsth, srcw, srch, bound, wp->vert, _vm->_bitDepth); drawWizPolygonImage(imageBuffer, src, NULL, dstpitch, kDstMemory, dstw, dsth, srcw, srch, bound, wp->vert, _vm->_bytesPerPixel);
captureImage(imageBuffer, dstpitch, dstw, dsth, resNum, wp->bound, compType); captureImage(imageBuffer, dstpitch, dstw, dsth, resNum, wp->bound, compType);
free(imageBuffer); free(imageBuffer);
@ -1812,7 +1812,7 @@ void Wiz::drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int
srcWizBuf = drawWizImage(resNum, state, 0, 0, 0, 0, 0, shadow, 0, r, flags, 0, _vm->getHEPaletteSlot(palette)); srcWizBuf = drawWizImage(resNum, state, 0, 0, 0, 0, 0, shadow, 0, r, flags, 0, _vm->getHEPaletteSlot(palette));
} else { } else {
assert(_vm->_bitDepth == 1); assert(_vm->_bytesPerPixel == 1);
uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum); uint8 *dataPtr = _vm->getResourceAddress(rtImage, resNum);
assert(dataPtr); assert(dataPtr);
srcWizBuf = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0); srcWizBuf = _vm->findWrappedBlock(MKID_BE('WIZD'), dataPtr, state, 0);
@ -1843,7 +1843,7 @@ void Wiz::drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int
dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0); dst = _vm->findWrappedBlock(MKID_BE('WIZD'), dstPtr, 0, 0);
assert(dst); assert(dst);
getWizImageDim(dstResNum, 0, dstw, dsth); getWizImageDim(dstResNum, 0, dstw, dsth);
dstpitch = dstw * _vm->_bitDepth; dstpitch = dstw * _vm->_bytesPerPixel;
dstType = kDstResource; dstType = kDstResource;
} else { } else {
if (flags & kWIFMarkBufferDirty) { if (flags & kWIFMarkBufferDirty) {
@ -1859,7 +1859,7 @@ void Wiz::drawWizPolygonTransform(int resNum, int state, Common::Point *wp, int
Common::Rect bound; Common::Rect bound;
getWizImageDim(resNum, state, wizW, wizH); getWizImageDim(resNum, state, wizW, wizH);
drawWizPolygonImage(dst, srcWizBuf, 0, dstpitch, dstType, dstw, dsth, wizW, wizH, bound, wp, _vm->_bitDepth); drawWizPolygonImage(dst, srcWizBuf, 0, dstpitch, dstType, dstw, dsth, wizW, wizH, bound, wp, _vm->_bytesPerPixel);
if (flags & kWIFMarkBufferDirty) { if (flags & kWIFMarkBufferDirty) {
_vm->markRectAsDirty(kMainVirtScreen, bound); _vm->markRectAsDirty(kMainVirtScreen, bound);
@ -1942,7 +1942,7 @@ void Wiz::drawWizPolygonImage(uint8 *dst, const uint8 *src, const uint8 *mask, i
int16 width = ppa->xmax - ppa->xmin + 1; int16 width = ppa->xmax - ppa->xmin + 1;
pra->x_step = ((ppa->x2 - ppa->x1) << 16) / width; pra->x_step = ((ppa->x2 - ppa->x1) << 16) / width;
pra->y_step = ((ppa->y2 - ppa->y1) << 16) / width; pra->y_step = ((ppa->y2 - ppa->y1) << 16) / width;
pra->dst_offs = yoff + x1 * _vm->_bitDepth; pra->dst_offs = yoff + x1 * _vm->_bytesPerPixel;
pra->w = w; pra->w = w;
pra->x_s = ppa->x1 << 16; pra->x_s = ppa->x1 << 16;
pra->y_s = ppa->y1 << 16; pra->y_s = ppa->y1 << 16;
@ -2024,7 +2024,7 @@ void Wiz::loadWizCursor(int resId, int palette) {
int32 cw, ch; int32 cw, ch;
getWizImageDim(resId, 0, cw, ch); getWizImageDim(resId, 0, cw, ch);
_vm->setCursorHotspot(x, y); _vm->setCursorHotspot(x, y);
_vm->setCursorFromBuffer(cursor, cw, ch, cw * _vm->_bitDepth); _vm->setCursorFromBuffer(cursor, cw, ch, cw * _vm->_bytesPerPixel);
// Since we set up cursor palette for default cursor, disable it now // Since we set up cursor palette for default cursor, disable it now
CursorMan.disableCursorPalette(true); CursorMan.disableCursorPalette(true);

View file

@ -254,7 +254,7 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_switchRoomEffect2 = 0; _switchRoomEffect2 = 0;
_switchRoomEffect = 0; _switchRoomEffect = 0;
_bitDepth = 0; _bytesPerPixel = 1;
_doEffect = false; _doEffect = false;
_snapScroll = false; _snapScroll = false;
_currentLights = 0; _currentLights = 0;
@ -528,11 +528,11 @@ ScummEngine::ScummEngine(OSystem *syst, const DetectorResult &dr)
_screenHeight = 200; _screenHeight = 200;
} }
_bitDepth = (_game.features & GF_16BIT_COLOR) ? 2 : 1; _bytesPerPixel = (_game.features & GF_16BIT_COLOR) ? 2 : 1;
// Allocate gfx compositing buffer (not needed for V7/V8 games). // Allocate gfx compositing buffer (not needed for V7/V8 games).
if (_game.version < 7) if (_game.version < 7)
_compositeBuf = (byte *)malloc(_screenWidth * _screenHeight * _bitDepth); _compositeBuf = (byte *)malloc(_screenWidth * _screenHeight * _bytesPerPixel);
else else
_compositeBuf = 0; _compositeBuf = 0;
@ -1225,7 +1225,7 @@ void ScummEngine::setupScumm() {
} }
free(_compositeBuf); free(_compositeBuf);
_compositeBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier * _bitDepth); _compositeBuf = (byte *)malloc(_screenWidth * _textSurfaceMultiplier * _screenHeight * _textSurfaceMultiplier * _bytesPerPixel);
} }
#ifdef ENABLE_SCUMM_7_8 #ifdef ENABLE_SCUMM_7_8

View file

@ -963,7 +963,7 @@ public:
int _screenTop; int _screenTop;
Common::RenderMode _renderMode; Common::RenderMode _renderMode;
uint8 _bitDepth; uint8 _bytesPerPixel;
protected: protected:
ColorCycle _colorCycle[16]; // Palette cycles ColorCycle _colorCycle[16]; // Palette cycles