[Scummvm-git-logs] scummvm master -> 443211d9ff31446ce5187ec1dc969f5629fac402

bgK bastien.bouclet at gmail.com
Sat Nov 11 13:27:16 CET 2017


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
1dbe3ad18e SDL: Fix assertion when using 4bpp cursors with a key color
08f9e05b15 SWORD25: Fix leaking the save thumbnail surface
443211d9ff SWORD25: Add a constructor to initialize SoundHandle members


Commit: 1dbe3ad18ea235debd29192f79537264cd247bab
    https://github.com/scummvm/scummvm/commit/1dbe3ad18ea235debd29192f79537264cd247bab
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-11-11T13:26:22+01:00

Commit Message:
SDL: Fix assertion when using 4bpp cursors with a key color

Myst ME uses such cursors.

Changed paths:
    backends/graphics/surfacesdl/surfacesdl-graphics.cpp


diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 4a6061c..6d3b3c4 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -1843,9 +1843,7 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h,
 		_cursorFormat = Graphics::PixelFormat::createFormatCLUT8();
 	}
 
-	if (_cursorFormat.bytesPerPixel == 4) {
-		assert(keyColor == 0);
-	} else {
+	if (_cursorFormat.bytesPerPixel < 4) {
 		assert(keyColor < 1U << (_cursorFormat.bytesPerPixel * 8));
 	}
 
@@ -1898,7 +1896,9 @@ void SurfaceSdlGraphicsManager::setMouseCursor(const void *buf, uint w, uint h,
 			error("Allocating _mouseOrigSurface failed");
 		}
 
-		if (_cursorFormat.bytesPerPixel < 4) {
+		if (_cursorFormat.bytesPerPixel == 4) {
+			SDL_SetColorKey(_mouseOrigSurface, SDL_SRCCOLORKEY | SDL_SRCALPHA, _mouseKeyColor);
+		} else {
 			SDL_SetColorKey(_mouseOrigSurface, SDL_RLEACCEL | SDL_SRCCOLORKEY | SDL_SRCALPHA, kMouseColorKey);
 		}
 	}
@@ -1979,7 +1979,7 @@ void SurfaceSdlGraphicsManager::blitCursor() {
 		}
 
 		SDL_PixelFormat *format = _mouseOrigSurface->format;
-		_mouseSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCALPHA,
+		_mouseSurface = SDL_CreateRGBSurface(SDL_SWSURFACE | SDL_SRCCOLORKEY | SDL_SRCALPHA,
 											 rW, rH,
 											 format->BitsPerPixel,
 											 format->Rmask,
@@ -1987,6 +1987,8 @@ void SurfaceSdlGraphicsManager::blitCursor() {
 											 format->Bmask,
 											 format->Amask);
 
+		SDL_SetColorKey(_mouseSurface, SDL_SRCCOLORKEY | SDL_SRCALPHA, _mouseKeyColor);
+
 		// At least SDL 2.0.4 on Windows apparently has a broken SDL_BlitScaled
 		// implementation, and SDL 1 has no such API at all, and our other
 		// scalers operate exclusively at 16bpp, so here is a scrappy 32bpp


Commit: 08f9e05b15e34886ff37962dd73169c26033ffb7
    https://github.com/scummvm/scummvm/commit/08f9e05b15e34886ff37962dd73169c26033ffb7
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-11-11T13:26:22+01:00

Commit Message:
SWORD25: Fix leaking the save thumbnail surface

Changed paths:
    engines/sword25/gfx/screenshot.cpp


diff --git a/engines/sword25/gfx/screenshot.cpp b/engines/sword25/gfx/screenshot.cpp
index c86a2fe..0b49697 100644
--- a/engines/sword25/gfx/screenshot.cpp
+++ b/engines/sword25/gfx/screenshot.cpp
@@ -115,6 +115,7 @@ Common::SeekableReadStream *Screenshot::createThumbnail(Graphics::Surface *data)
 	// Create a PNG representation of the thumbnail data
 	Common::MemoryWriteStreamDynamic stream(DisposeAfterUse::NO);
 	saveToFile(&thumbnail, &stream);
+	thumbnail.free();
 
 	// Output a MemoryReadStream that encompasses the written data
 	Common::SeekableReadStream *result = new Common::MemoryReadStream(stream.getData(), stream.size(),


Commit: 443211d9ff31446ce5187ec1dc969f5629fac402
    https://github.com/scummvm/scummvm/commit/443211d9ff31446ce5187ec1dc969f5629fac402
Author: Bastien Bouclet (bastien.bouclet at gmail.com)
Date: 2017-11-11T13:26:22+01:00

Commit Message:
SWORD25: Add a constructor to initialize SoundHandle members

Fixes #7018

Changed paths:
    engines/sword25/sfx/soundengine.cpp
    engines/sword25/sfx/soundengine.h


diff --git a/engines/sword25/sfx/soundengine.cpp b/engines/sword25/sfx/soundengine.cpp
index 46f27b0..8bc2018 100644
--- a/engines/sword25/sfx/soundengine.cpp
+++ b/engines/sword25/sfx/soundengine.cpp
@@ -65,9 +65,6 @@ SoundEngine::SoundEngine(Kernel *pKernel) : ResourceService(pKernel) {
 	_mixer = g_system->getMixer();
 
 	_maxHandleId = 1;
-
-	for (int i = 0; i < SOUND_HANDLES; i++)
-		_handles[i].type = kFreeHandle;
 }
 
 bool SoundEngine::init(uint sampleRate, uint channels) {
@@ -394,5 +391,16 @@ bool SoundEngine::unpersist(InputPersistenceBlock &reader) {
 	return reader.isGood();
 }
 
+SndHandle::SndHandle() :
+		type(kFreeHandle),
+		id(0),
+		sndType(-1),
+		volume(0),
+		pan(0),
+		loop(false),
+		loopStart(0),
+		loopEnd(0),
+		layer(0) {
+}
 
 } // End of namespace Sword25
diff --git a/engines/sword25/sfx/soundengine.h b/engines/sword25/sfx/soundengine.h
index 9bf251b..9b4b329 100644
--- a/engines/sword25/sfx/soundengine.h
+++ b/engines/sword25/sfx/soundengine.h
@@ -73,6 +73,8 @@ struct SndHandle {
 	int32 loopStart;
 	int32 loopEnd;
 	uint32 layer;
+
+	SndHandle();
 };
 
 





More information about the Scummvm-git-logs mailing list