aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/prince/object.cpp7
-rw-r--r--engines/prince/prince.cpp10
2 files changed, 12 insertions, 5 deletions
diff --git a/engines/prince/object.cpp b/engines/prince/object.cpp
index 1edabb63e0..e4dece4426 100644
--- a/engines/prince/object.cpp
+++ b/engines/prince/object.cpp
@@ -38,11 +38,16 @@ Object::Object() : _surface(nullptr), _x(0), _y(0), _z(0), _flags(0), _width(0),
}
Object::~Object() {
- if (_surface) {
+ if (_surface != nullptr) {
_surface->free();
delete _surface;
_surface = nullptr;
}
+ if (_zoomSurface) {
+ _zoomSurface->free();
+ delete _zoomSurface;
+ _zoomSurface = nullptr;
+ }
}
void Object::loadSurface(Common::SeekableReadStream &stream) {
diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp
index d6981ee90d..31702484d8 100644
--- a/engines/prince/prince.cpp
+++ b/engines/prince/prince.cpp
@@ -1512,7 +1512,8 @@ void PrinceEngine::doZoomIn(int slot) {
byte *dst1 = (byte *)object->_zoomSurface->getBasePtr(0, 0);
int x = 0;
int w, rand;
- for (int y = 0; y < orgSurface->h; y++) {
+ int surfaceHeight = orgSurface->h;
+ for (int y = 0; y < surfaceHeight; y++) {
byte *src2 = src1;
byte *dst2 = dst1;
w = orgSurface->w - x;
@@ -1524,7 +1525,7 @@ void PrinceEngine::doZoomIn(int slot) {
*(dst2 + rand) = *(src2 + rand);
src2 += zoomInStep;
dst2 += zoomInStep;
- } else {
+ } else if (y + 1 != surfaceHeight) {
*(dst1 + orgSurface->pitch + rand - w) = *(src1 + orgSurface->pitch + rand - w);
}
w -= zoomInStep;
@@ -1545,7 +1546,8 @@ void PrinceEngine::doZoomOut(int slot) {
byte *dst1 = (byte *)object->_zoomSurface->getBasePtr(0, 0);
int x = 0;
int w, rand;
- for (int y = 0; y < orgSurface->h; y++) {
+ int surfaceHeight = orgSurface->h;
+ for (int y = 0; y < surfaceHeight; y++) {
byte *dst2 = dst1;
w = orgSurface->w - x;
dst2 += x;
@@ -1554,7 +1556,7 @@ void PrinceEngine::doZoomOut(int slot) {
if (rand < w) {
*(dst2 + rand) = 255;
dst2 += zoomInStep;
- } else {
+ } else if (y + 1 != surfaceHeight) {
*(dst1 + orgSurface->pitch + rand - w) = 255;
}
w -= zoomInStep;