diff options
author | Johannes Schickel | 2006-04-25 15:20:46 +0000 |
---|---|---|
committer | Johannes Schickel | 2006-04-25 15:20:46 +0000 |
commit | 6b225b40faaba652ba5f8b87ba5107720c6c5079 (patch) | |
tree | 93ae90c6b3e086cd20ae065f385f94bdef0954dd /gui | |
parent | 58462fa682fc0c6a408cacd5879491503ddff812 (diff) | |
download | scummvm-rg350-6b225b40faaba652ba5f8b87ba5107720c6c5079.tar.gz scummvm-rg350-6b225b40faaba652ba5f8b87ba5107720c6c5079.tar.bz2 scummvm-rg350-6b225b40faaba652ba5f8b87ba5107720c6c5079.zip |
Uses the special cursor color palette for the cursor now (this fixes problems with creation of thumbnails of the scumm engine)
svn-id: r22152
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeNew.cpp | 32 | ||||
-rw-r--r-- | gui/theme.h | 4 |
2 files changed, 12 insertions, 24 deletions
diff --git a/gui/ThemeNew.cpp b/gui/ThemeNew.cpp index fd6a9f5675..27fe15a673 100644 --- a/gui/ThemeNew.cpp +++ b/gui/ThemeNew.cpp @@ -97,7 +97,7 @@ ThemeNew::ThemeNew(OSystem *system, Common::String stylefile) : Theme(), _system _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(0), _forceRedraw(false), _fonts(), _imageHandles(0), _images(0) _lastUsedBitMask = gBitFormat; // creats the cursor image - createCursor(); + if (_system->hasFeature(OSystem::kFeatureCursorHasPalette)) { + createCursor(); + } } ThemeNew::~ThemeNew() { @@ -362,16 +364,15 @@ void ThemeNew::enable() { 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::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() { @@ -1516,11 +1505,9 @@ OverlayColor ThemeNew::calcDimColor(OverlayColor col) { #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 @@ void ThemeNew::createCursor() { } src += _cursorWidth; } - + + _useCursor = true; delete [] table; } diff --git a/gui/theme.h b/gui/theme.h index 5d75e73a9f..cfbf4f95c1 100644 --- a/gui/theme.h +++ b/gui/theme.h @@ -285,7 +285,7 @@ public: void refresh(); - bool ownCursor() { return true; } + bool ownCursor() { return _useCursor; } void enable(); void disable(); @@ -450,6 +450,7 @@ private: OverlayColor calcLuminance(OverlayColor col); OverlayColor calcDimColor(OverlayColor col); + bool _useCursor; void setUpCursor(); void createCursor(); int _cursorHotspotX, _cursorHotspotY; @@ -458,7 +459,6 @@ private: bool _needPaletteUpdates; uint _cursorWidth, _cursorHeight; byte _cursorPal[4*MAX_CURS_COLORS]; - byte _backUpCols[4*MAX_CURS_COLORS]; private: const String *_imageHandles; |