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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Tue Apr 25 08:21:11 CEST 2006


Revision: 22152
Author:   lordhoto
Date:     2006-04-25 08:20:46 -0700 (Tue, 25 Apr 2006)
ViewCVS:  http://svn.sourceforge.net/scummvm/?rev=22152&view=rev

Log Message:
-----------
Uses the special cursor color palette for the cursor now (this fixes problems with creation of thumbnails of the 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-25 14:59:42 UTC (rev 22151)
+++ scummvm/trunk/gui/ThemeNew.cpp	2006-04-25 15:20:46 UTC (rev 22152)
@@ -97,7 +97,7 @@
 _lastUsedBitMask(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0), _colors(), _cursor(0), _gradientFactors() {
 	_stylefile = stylefile;
 	_initOk = false;
-	_needPaletteUpdates = false;
+	_useCursor = false;
 	memset(&_screen, 0, sizeof(_screen));
 	memset(&_dialog, 0, sizeof(_dialog));
 	memset(&_colors, 0, sizeof(_colors));
@@ -301,7 +301,9 @@
 	_lastUsedBitMask = gBitFormat;
 
 	// creats the cursor image
-	createCursor();
+	if (_system->hasFeature(OSystem::kFeatureCursorHasPalette)) {
+		createCursor();
+	}
 }
 
 ThemeNew::~ThemeNew() {
@@ -362,16 +364,15 @@
 	init();
 	resetupGuiRenderer();
 	resetDrawArea();
+	setUpCursor();
 	_system->showOverlay();
 	clearAll();
-	setUpCursor();
 	_enabled = true;
 }
 
 void ThemeNew::disable() {
+	_system->disableCursorPalette(true);
 	_system->hideOverlay();
-	_system->setPalette(_backUpCols, 0, MAX_CURS_COLORS);
-	_needPaletteUpdates = false;
 	_enabled = false;
 }
 
@@ -411,21 +412,9 @@
 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() {
@@ -1516,11 +1505,9 @@
 #pragma mark -
 
 void ThemeNew::setUpCursor() {
-	_system->grabPalette(_backUpCols, 0, MAX_CURS_COLORS);
-	_system->setPalette(_cursorPal, 0, MAX_CURS_COLORS);
-
+	_system->setCursorPalette(_cursorPal, 0, MAX_CURS_COLORS);
 	_system->setMouseCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY);
-	_needPaletteUpdates = true;
+	_system->disableCursorPalette(false);
 }
 
 void ThemeNew::createCursor() {
@@ -1569,7 +1556,8 @@
 		}
 		src += _cursorWidth;
 	}
-
+	
+	_useCursor = true;
 	delete [] table;
 }
 

Modified: scummvm/trunk/gui/theme.h
===================================================================
--- scummvm/trunk/gui/theme.h	2006-04-25 14:59:42 UTC (rev 22151)
+++ scummvm/trunk/gui/theme.h	2006-04-25 15:20:46 UTC (rev 22152)
@@ -285,7 +285,7 @@
 
 	void refresh();
 
-	bool ownCursor() { return true; }
+	bool ownCursor() { return _useCursor; }
 
 	void enable();
 	void disable();
@@ -450,6 +450,7 @@
 	OverlayColor calcLuminance(OverlayColor col);
 	OverlayColor calcDimColor(OverlayColor col);
 
+	bool _useCursor;
 	void setUpCursor();
 	void createCursor();
 	int _cursorHotspotX, _cursorHotspotY;
@@ -458,7 +459,6 @@
 	bool _needPaletteUpdates;
 	uint _cursorWidth, _cursorHeight;
 	byte _cursorPal[4*MAX_CURS_COLORS];
-	byte _backUpCols[4*MAX_CURS_COLORS];
 
 private:
 	const String *_imageHandles;


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