[Scummvm-cvs-logs] SF.net SVN: scummvm:[53337] scummvm/trunk/engines/sword25/gfx/opengl/ glimage.cpp
sev at users.sourceforge.net
sev at users.sourceforge.net
Wed Oct 13 01:43:44 CEST 2010
Revision: 53337
http://scummvm.svn.sourceforge.net/scummvm/?rev=53337&view=rev
Author: sev
Date: 2010-10-12 23:43:44 +0000 (Tue, 12 Oct 2010)
Log Message:
-----------
SWORD25: Fix memory leak in transparency commit
At the point where the alpha value was checked, a scaled image surface may have already been created, which needs to be freed.
Modified Paths:
--------------
scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
Modified: scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp 2010-10-12 23:43:24 UTC (rev 53336)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp 2010-10-12 23:43:44 UTC (rev 53337)
@@ -204,7 +204,7 @@
Graphics::Surface *img;
Graphics::Surface *imgScaled = NULL;
- byte *savedPixels;
+ byte *savedPixels = NULL;
if ((width != srcImage.w) || (height != srcImage.h)) {
// Scale the image
img = imgScaled = scale(srcImage, width, height);
@@ -218,10 +218,6 @@
int cg = (color >> 8) & 0xff;
int cb = (color >> 0) & 0xff;
- // Check if we need to draw anything at all
- if (ca == 0)
- return true;
-
if (ca != 255) {
cr = cr * ca >> 8;
cg = cg * ca >> 8;
@@ -244,7 +240,7 @@
img->w = CLIP((int)img->w, 0, (int)MAX((int)_backSurface->w - posX, 0));
img->h = CLIP((int)img->h, 0, (int)MAX((int)_backSurface->h - posY, 0));
- if (img->w > 0 && img->h > 0) {
+ if ((ca != 0) && (img->w > 0) && (img->h > 0)) {
int xp = 0, yp = 0;
int inStep = 4;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list