[Scummvm-cvs-logs] SF.net SVN: scummvm: [22024] scummvm/trunk/gui

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Apr 18 23:01:01 CEST 2006


Revision: 22024
Author:   lordhoto
Date:     2006-04-18 23:00:34 -0700 (Tue, 18 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22024&view=rev

Log Message:
-----------
Fixes problems with wrong colors on the overlay in scumm engine.

Modified Paths:
--------------
    scummvm/trunk/gui/ThemeNew.cpp
    scummvm/trunk/gui/theme.h
Modified: scummvm/trunk/gui/ThemeNew.cpp
===================================================================
--- scummvm/trunk/gui/ThemeNew.cpp	2006-04-19 05:50:03 UTC (rev 22023)
+++ scummvm/trunk/gui/ThemeNew.cpp	2006-04-19 06:00:34 UTC (rev 22024)
@@ -97,6 +97,7 @@
 _lastUsedBitMask(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0), _colors(), _gradientFactors() {
 	_stylefile = stylefile;
 	_initOk = false;
+	_needPaletteUpdates = false;
 	memset(&_screen, 0, sizeof(_screen));
 	memset(&_dialog, 0, sizeof(_dialog));
 	memset(&_colors, 0, sizeof(_colors));
@@ -368,6 +369,7 @@
 void ThemeNew::disable() {
 	_system->hideOverlay();
 	_system->setPalette(_backUpCols, 0, MAX_CURS_COLORS);
+	_needPaletteUpdates = false;
 }
 
 void ThemeNew::openDialog(bool topDialog) {
@@ -406,9 +408,21 @@
 void ThemeNew::clearAll() {
 	if (!_initOk)
 		return;
+	if (_needPaletteUpdates) {
+		// we need to set the original palette here so the recived overlay looks correct in scumm engine for example
+		_system->setPalette(_backUpCols, 0, MAX_CURS_COLORS);
+		// update screen to finish updating the palette
+		_system->updateScreen();
+	}
+
 	_system->clearOverlay();
 	// FIXME: problem with the 'pitch'
 	_system->grabOverlay((OverlayColor*)_screen.pixels, _screen.w);
+
+	if (_needPaletteUpdates) {
+		// our palette again
+		_system->setPalette(_cursorPal, 0, MAX_CURS_COLORS);
+	}
 }
 
 void ThemeNew::drawAll() {
@@ -1503,6 +1517,7 @@
 	_system->setPalette(_cursorPal, 0, MAX_CURS_COLORS);
 
 	_system->setMouseCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY);
+	_needPaletteUpdates = true;
 }
 
 void ThemeNew::createCursor() {

Modified: scummvm/trunk/gui/theme.h
===================================================================
--- scummvm/trunk/gui/theme.h	2006-04-19 05:50:03 UTC (rev 22023)
+++ scummvm/trunk/gui/theme.h	2006-04-19 06:00:34 UTC (rev 22024)
@@ -452,6 +452,7 @@
 	int _cursorHotspotX, _cursorHotspotY;
 #define MAX_CURS_COLORS 255
 	byte *_cursor;
+	bool _needPaletteUpdates;
 	uint _cursorWidth, _cursorHeight;
 	byte _cursorPal[4*MAX_CURS_COLORS];
 	byte _backUpCols[4*MAX_CURS_COLORS];


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