aboutsummaryrefslogtreecommitdiff
path: root/engines/prince/graphics.cpp
diff options
context:
space:
mode:
authorlukaslw2014-05-14 00:21:59 +0200
committerlukaslw2014-06-22 20:08:03 +0200
commit2c9559b620def087f1d7e9bff3b2a07686c946f6 (patch)
treed740b785048f1bd2f9c931aca1d854fe358d5e1d /engines/prince/graphics.cpp
parent07b232804f2e3dcaf7935b794e31a68fe03eb824 (diff)
downloadscummvm-rg350-2c9559b620def087f1d7e9bff3b2a07686c946f6.tar.gz
scummvm-rg350-2c9559b620def087f1d7e9bff3b2a07686c946f6.tar.bz2
scummvm-rg350-2c9559b620def087f1d7e9bff3b2a07686c946f6.zip
PRINCE: Hero drawing - memory leak fix, shadow palette working
Diffstat (limited to 'engines/prince/graphics.cpp')
-rw-r--r--engines/prince/graphics.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp
index ab6eec3d0b..5b66994b47 100644
--- a/engines/prince/graphics.cpp
+++ b/engines/prince/graphics.cpp
@@ -63,8 +63,7 @@ void GraphicsMan::change() {
_changed = true;
}
-void GraphicsMan::draw(uint16 posX, uint16 posY, const Graphics::Surface *s)
-{
+void GraphicsMan::draw(uint16 posX, uint16 posY, const Graphics::Surface *s) {
uint16 w = MIN(_frontScreen->w, s->w);
for (uint y = 0; y < s->h; y++) {
if (y < _frontScreen->h) {
@@ -74,18 +73,16 @@ void GraphicsMan::draw(uint16 posX, uint16 posY, const Graphics::Surface *s)
change();
}
-void GraphicsMan::drawTransparent(uint16 posX, uint16 posY, const Graphics::Surface *s)
-{
+void GraphicsMan::drawTransparent(uint16 posX, uint16 posY, const Graphics::Surface *s) {
for (uint y = 0; y < s->h; ++y) {
for (uint x = 0; x < s->w; ++x) {
byte pixel = *((byte*)s->getBasePtr(x, y));
if (pixel != 255) {
- //*((byte*)_frontScreen->getBasePtr(x, y)) = pixel;
*((byte*)_frontScreen->getBasePtr(x + posX, y + posY)) = pixel;
}
}
}
- change();
+ change();
}
void GraphicsMan::makeShadowTable(int brightness, byte *shadowPalette) {
@@ -98,9 +95,8 @@ void GraphicsMan::makeShadowTable(int brightness, byte *shadowPalette) {
int32 currColor;
int shadow = brightness * 256 / 100;
- byte *originalPalette = (byte *)malloc(256 * 3);
- _vm->_system->getPaletteManager()->grabPalette(originalPalette, 0, 256);
+ const byte *originalPalette = _vm->_roomBmp->getPalette();
for (int i = 0; i < 256; i++) {
redFirstOrg = originalPalette[3 * i] * shadow / 256;
@@ -136,7 +132,6 @@ void GraphicsMan::makeShadowTable(int brightness, byte *shadowPalette) {
}
shadowPalette[i] = currColor;
}
- free(originalPalette);
}
}