aboutsummaryrefslogtreecommitdiff
path: root/engines/kyra/screen_eob.cpp
diff options
context:
space:
mode:
authorathrxx2011-09-13 21:46:23 +0200
committerJohannes Schickel2011-12-26 16:18:15 +0100
commit68ed8b95989d784fe42f4e6e400224ffb63ba80b (patch)
treee0985bd857f88648bb0714df6c3852a24f558997 /engines/kyra/screen_eob.cpp
parent816b40ebf8c653f4c3f898ae4697ea85f5fe015f (diff)
downloadscummvm-rg350-68ed8b95989d784fe42f4e6e400224ffb63ba80b.tar.gz
scummvm-rg350-68ed8b95989d784fe42f4e6e400224ffb63ba80b.tar.bz2
scummvm-rg350-68ed8b95989d784fe42f4e6e400224ffb63ba80b.zip
KYRA: (EOB) - fix some valgrind warnings
Diffstat (limited to 'engines/kyra/screen_eob.cpp')
-rw-r--r--engines/kyra/screen_eob.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/engines/kyra/screen_eob.cpp b/engines/kyra/screen_eob.cpp
index 4161c757d8..8562e25480 100644
--- a/engines/kyra/screen_eob.cpp
+++ b/engines/kyra/screen_eob.cpp
@@ -46,6 +46,7 @@ Screen_Eob::Screen_Eob(EobCoreEngine *vm, OSystem *system) : Screen(vm, system)
_gfxCol = 0;
_customDimTable = 0;
_dsTempPage = 0;
+ _curDimIndex = 0;
}
Screen_Eob::~Screen_Eob() {
@@ -266,7 +267,7 @@ uint8 *Screen_Eob::encodeShape(uint16 x, uint16 y, uint16 w, uint16 h, bool no4b
uint8 *colorMap = new uint8[0x100];
memset (colorMap, 0xff, 0x100);
- shapesize = h * (w << 2) + 0x14;
+ shapesize = h * (w << 2) + 20;
shp = new uint8[shapesize];
memset (shp, 0, shapesize);
uint8 *dst = shp;
@@ -673,14 +674,13 @@ const uint8 *Screen_Eob::scaleShapeStep(const uint8 *shp) {
i = -i;
_dsScaleTmp = (i << 4) | (i & 0x0f);
- memcpy(d, shp, 16);
- d += 16;
- shp += 16;
+ for (int ii = 0; ii < 16; ii++)
+ *d++ = *shp++;
_dsDiv = w2 / 3;
_dsRem = w2 % 3;
- do {
+ while (--h) {
scaleShapeProcessLine(d, shp);
if (!--h)
break;
@@ -688,7 +688,7 @@ const uint8 *Screen_Eob::scaleShapeStep(const uint8 *shp) {
if (!--h)
break;
shp += w2;
- } while (--h);
+ }
return (const uint8 *) _dsTempPage;
}
@@ -1100,15 +1100,14 @@ void Screen_Eob::drawShapeSetPixel(uint8 * dst, uint8 c) {
void Screen_Eob::scaleShapeProcessLine(uint8 *&dst, const uint8 *&src) {
for (int i = 0; i < _dsDiv; i++) {
*dst++ = *src++;
- *dst++ = READ_BE_UINT16(src) >> 4;
+ *dst++ = (READ_BE_UINT16(src) >> 4) & 0xff;
src += 2;
}
if (_dsRem == 1) {
*dst++ = *src++;
*dst++ = _dsScaleTmp;
-
- } if (_dsRem == 2) {
+ } else if (_dsRem == 2) {
*dst++ = (src[0] & 0xf0) | (src[1] >> 4);
src += 2;
*dst++ = _dsScaleTmp;