aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/graphics/transparent_surface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute/graphics/transparent_surface.cpp')
-rw-r--r--engines/wintermute/graphics/transparent_surface.cpp19
1 files changed, 11 insertions, 8 deletions
diff --git a/engines/wintermute/graphics/transparent_surface.cpp b/engines/wintermute/graphics/transparent_surface.cpp
index 9319899495..dcdcbf247e 100644
--- a/engines/wintermute/graphics/transparent_surface.cpp
+++ b/engines/wintermute/graphics/transparent_surface.cpp
@@ -29,11 +29,11 @@
namespace Wintermute {
-byte *TransparentSurface::_lookup = NULL;
+byte *TransparentSurface::_lookup = nullptr;
void TransparentSurface::destroyLookup() {
- delete _lookup;
- _lookup = NULL;
+ delete[] _lookup;
+ _lookup = nullptr;
}
TransparentSurface::TransparentSurface() : Surface(), _enableAlphaBlit(true) {}
@@ -218,9 +218,9 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
height = height * 2 / 3;
#endif
- Graphics::Surface *img;
- Graphics::Surface *imgScaled = NULL;
- byte *savedPixels = NULL;
+ Graphics::Surface *img = nullptr;
+ Graphics::Surface *imgScaled = nullptr;
+ byte *savedPixels = nullptr;
if ((width != srcImage.w) || (height != srcImage.h)) {
// Scale the image
img = imgScaled = srcImage.scale(width, height);
@@ -371,14 +371,15 @@ Common::Rect TransparentSurface::blit(Graphics::Surface &target, int posX, int p
}
}
+ retSize.setWidth(img->w);
+ retSize.setHeight(img->h);
+
if (imgScaled) {
imgScaled->pixels = savedPixels;
imgScaled->free();
delete imgScaled;
}
- retSize.setWidth(img->w);
- retSize.setHeight(img->h);
return retSize;
}
@@ -394,6 +395,8 @@ TransparentSurface *TransparentSurface::scale(const Common::Rect &srcRect, const
// dstRect(x, y) = srcRect(x * srcW / dstW, y * srcH / dstH);
TransparentSurface *target = new TransparentSurface();
+ assert(format.bytesPerPixel == 4);
+
int srcW = srcRect.width();
int srcH = srcRect.height();
int dstW = dstRect.width();