aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/disk_ns.cpp15
-rw-r--r--engines/parallaction/graphics.cpp18
-rw-r--r--engines/parallaction/graphics.h2
3 files changed, 20 insertions, 15 deletions
diff --git a/engines/parallaction/disk_ns.cpp b/engines/parallaction/disk_ns.cpp
index 9c93a9f9df..b79e845ad3 100644
--- a/engines/parallaction/disk_ns.cpp
+++ b/engines/parallaction/disk_ns.cpp
@@ -589,20 +589,21 @@ void DosDisk_ns::loadBackground(const char *filename) {
parseBackground(_resArchive);
- byte *bg = (byte*)calloc(1, _vm->_screenSize);
+ Graphics::Surface *bg = new Graphics::Surface;
+ bg->create(_vm->_screenWidth, _vm->_screenHeight, 1);
+
BitBuffer *mask = new BitBuffer;
mask->create(_vm->_screenWidth, _vm->_screenHeight);
byte *path = (byte*)calloc(1, _vm->_screenPathSize);
Graphics::PackBitsReadStream stream(_resArchive);
- unpackBackground(&stream, bg, mask->data, path);
+ unpackBackground(&stream, (byte*)bg->pixels, mask->data, path);
_vm->_gfx->setBackground(bg);
_vm->_gfx->setMask(mask);
_vm->setPath(path);
- free(bg);
free(path);
return;
@@ -1191,17 +1192,17 @@ void AmigaDisk_ns::loadBackground(const char *name) {
Common::SeekableReadStream *s = openArchivedFile(name, true);
- Graphics::Surface surf;
+ Graphics::Surface *surf = new Graphics::Surface;
byte *pal;
- BackgroundDecoder decoder(*s, surf, pal, _vm->_gfx->_palettefx);
+ BackgroundDecoder decoder(*s, *surf, pal, _vm->_gfx->_palettefx);
decoder.decode();
for (uint32 i = 0; i < BASE_PALETTE_COLORS * 3; i++)
_vm->_gfx->_palette[i] = pal[i] >> 2;
free(pal);
_vm->_gfx->setPalette(_vm->_gfx->_palette);
- _vm->_gfx->setBackground(static_cast<byte*>(surf.pixels));
- surf.free();
+ _vm->_gfx->setBackground(surf);
+
delete s;
return;
diff --git a/engines/parallaction/graphics.cpp b/engines/parallaction/graphics.cpp
index 5f33b49cda..b13519ed2a 100644
--- a/engines/parallaction/graphics.cpp
+++ b/engines/parallaction/graphics.cpp
@@ -752,9 +752,12 @@ void Gfx::freeStaticCnv(StaticCnv *cnv) {
-void Gfx::setBackground(byte *background) {
- memcpy(_buffers[kBitBack]->pixels, background, _vm->_screenSize);
- copyScreen(kBitBack, kBit2);
+void Gfx::setBackground(Graphics::Surface *surface) {
+ if (_buffers[kBit2])
+ delete _buffers[kBit2];
+
+ _buffers[kBit2] = surface;
+ copyScreen(kBit2, kBitBack);
}
void Gfx::setMask(BitBuffer *buffer) {
@@ -847,8 +850,8 @@ Gfx::Gfx(Parallaction* vm) :
_buffers[kBitFront]->create(_vm->_screenWidth, _vm->_screenHeight, 1);
_buffers[kBitBack] = new Graphics::Surface;
_buffers[kBitBack]->create(_vm->_screenWidth, _vm->_screenHeight, 1);
- _buffers[kBit2] = new Graphics::Surface;
- _buffers[kBit2]->create(_vm->_screenWidth, _vm->_screenHeight, 1);
+
+ _buffers[kBit2] = 0;
_depthMask = 0;
@@ -878,8 +881,9 @@ Gfx::~Gfx() {
delete _buffers[kBitFront];
_buffers[kBitBack]->free();
delete _buffers[kBitBack];
- _buffers[kBit2]->free();
- delete _buffers[kBit2];
+
+ if (_buffers[kBit2])
+ delete _buffers[kBit2];
delete _fonts[kFontDialogue];
delete _fonts[kFontLabel];
diff --git a/engines/parallaction/graphics.h b/engines/parallaction/graphics.h
index f1104eb27b..a820436aa2 100644
--- a/engines/parallaction/graphics.h
+++ b/engines/parallaction/graphics.h
@@ -219,7 +219,7 @@ public:
void restoreDoorBackground(StaticCnv *cnv, const Common::Rect& r, byte* background);
// location
- void setBackground(byte *background);
+ void setBackground(Graphics::Surface *surf);
void setMask(BitBuffer *buffer);
int16 queryMask(int16 v);
void intGrottaHackMask();