aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2006-04-19 06:00:34 +0000
committerJohannes Schickel2006-04-19 06:00:34 +0000
commit1c65f3417af37329284a0f36f4b451d11308660a (patch)
treebefc01051a65349bdfeb3404a650a65a1f2b966c
parentaf8b2d83f78336a3fa5d03ed1eb4386f9541de1c (diff)
downloadscummvm-rg350-1c65f3417af37329284a0f36f4b451d11308660a.tar.gz
scummvm-rg350-1c65f3417af37329284a0f36f4b451d11308660a.tar.bz2
scummvm-rg350-1c65f3417af37329284a0f36f4b451d11308660a.zip
Fixes problems with wrong colors on the overlay in scumm engine.
svn-id: r22024
-rw-r--r--gui/ThemeNew.cpp15
-rw-r--r--gui/theme.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp
index 8caaa1dd59..2b32425996 100644
--- a/gui/ThemeNew.cpp
+++ b/gui/ThemeNew.cpp
@@ -97,6 +97,7 @@ ThemeNew::ThemeNew(OSystem *system, Common::String stylefile) : Theme(), _system
_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::enable() {
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::closeDialog() {
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 @@ void ThemeNew::setUpCursor() {
_system->setPalette(_cursorPal, 0, MAX_CURS_COLORS);
_system->setMouseCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY);
+ _needPaletteUpdates = true;
}
void ThemeNew::createCursor() {
diff --git a/gui/theme.h b/gui/theme.h
index cd191ac2d8..e641148eda 100644
--- a/gui/theme.h
+++ b/gui/theme.h
@@ -452,6 +452,7 @@ private:
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];