[Scummvm-cvs-logs] SF.net SVN: scummvm:[36027] scummvm/branches/branch-0-13-0/gui

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Sat Jan 24 00:51:29 CET 2009


Revision: 36027
          http://scummvm.svn.sourceforge.net/scummvm/?rev=36027&view=rev
Author:   fingolfin
Date:     2009-01-23 23:51:28 +0000 (Fri, 23 Jan 2009)

Log Message:
-----------
Backported image (re)loading fix to ThemeEngine from trunk to branch-0-13-0

Modified Paths:
--------------
    scummvm/branches/branch-0-13-0/gui/ThemeEngine.cpp
    scummvm/branches/branch-0-13-0/gui/ThemeEngine.h

Modified: scummvm/branches/branch-0-13-0/gui/ThemeEngine.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/gui/ThemeEngine.cpp	2009-01-23 23:50:54 UTC (rev 36026)
+++ scummvm/branches/branch-0-13-0/gui/ThemeEngine.cpp	2009-01-23 23:51:28 UTC (rev 36027)
@@ -362,6 +362,7 @@
 	// reset everything and reload the graphics
 	_initOk = false;
 	setGraphicsMode(_graphicsMode);
+	_overlayFormat = _system->getOverlayFormat();
 
 	if (_screen.pixels && _backBuffer.pixels) {
 		_initOk = true;
@@ -414,6 +415,20 @@
 }
 
 void ThemeEngine::refresh() {
+	
+	// Flush all bitmaps if the overlay pixel format changed.
+	const Graphics::PixelFormat tmpFormat = _system->getOverlayFormat();
+	if (0 != memcmp(&_overlayFormat, &tmpFormat, sizeof(Graphics::PixelFormat))) {
+		for (ImagesMap::iterator i = _bitmaps.begin(); i != _bitmaps.end(); ++i) {
+			Graphics::Surface *surf = i->_value;
+			if (surf) {
+				surf->free();
+				delete surf;
+			}
+		}
+		_bitmaps.clear();
+	}
+
 	init();
 	if (_enabled) {
 		_system->showOverlay();
@@ -1040,8 +1055,7 @@
 	Common::Rect charArea = r;
 	charArea.clip(_screen.w, _screen.h);
 
-	Graphics::PixelFormat format = _system->getOverlayFormat();
-	uint32 color = Graphics::RGBToColor(_texts[kTextDataDefault]->_color.r, _texts[kTextDataDefault]->_color.g, _texts[kTextDataDefault]->_color.b, format);
+	uint32 color = Graphics::RGBToColor(_texts[kTextDataDefault]->_color.r, _texts[kTextDataDefault]->_color.g, _texts[kTextDataDefault]->_color.b, _overlayFormat);
 
 	restoreBackground(charArea);
 	font->drawChar(&_screen, ch, charArea.left, charArea.top, color);
@@ -1146,11 +1160,10 @@
 	uint colorsFound = 0;
 	Common::HashMap<int, int>	colorToIndex;
 	const OverlayColor *src = (const OverlayColor*)cursor->pixels;
-	Graphics::PixelFormat format = _system->getOverlayFormat();
 	for (uint y = 0; y < _cursorHeight; ++y) {
 		for (uint x = 0; x < _cursorWidth; ++x) {
 			byte r, g, b;
-			Graphics::colorToRGB(src[x], r, g, b, format);
+			Graphics::colorToRGB(src[x], r, g, b, _overlayFormat);
 			const int col = (r << 16) | (g << 8) | b;
 
 			// Skip transparency (the transparent color actually is 0xFF00FF,

Modified: scummvm/branches/branch-0-13-0/gui/ThemeEngine.h
===================================================================
--- scummvm/branches/branch-0-13-0/gui/ThemeEngine.h	2009-01-23 23:50:54 UTC (rev 36026)
+++ scummvm/branches/branch-0-13-0/gui/ThemeEngine.h	2009-01-23 23:51:28 UTC (rev 36027)
@@ -584,6 +584,7 @@
 	TextDrawData *_texts[kTextDataMAX];
 
 	ImagesMap _bitmaps;
+	Graphics::PixelFormat _overlayFormat;
 
 	/** List of all the dirty screens that must be blitted to the overlay. */
 	Common::List<Common::Rect> _dirtyScreen;


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