[Scummvm-cvs-logs] SF.net SVN: scummvm:[36001] scummvm/trunk/gui
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Thu Jan 22 19:45:06 CET 2009
Revision: 36001
http://scummvm.svn.sourceforge.net/scummvm/?rev=36001&view=rev
Author: fingolfin
Date: 2009-01-22 18:45:06 +0000 (Thu, 22 Jan 2009)
Log Message:
-----------
Fix buggy images in GUI when switching overlay mode (e.g. on Mac OS X when toggline full screen and windowed mode)
Modified Paths:
--------------
scummvm/trunk/gui/ThemeEngine.cpp
scummvm/trunk/gui/ThemeEngine.h
Modified: scummvm/trunk/gui/ThemeEngine.cpp
===================================================================
--- scummvm/trunk/gui/ThemeEngine.cpp 2009-01-22 18:33:02 UTC (rev 36000)
+++ scummvm/trunk/gui/ThemeEngine.cpp 2009-01-22 18:45:06 UTC (rev 36001)
@@ -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,7 +415,21 @@
}
void ThemeEngine::refresh() {
+
+ // Flush all bitmaps if the overlay pixel format changed.
+ if (_overlayFormat != _system->getOverlayFormat()) {
+ 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 = format.RGBToColor(_texts[kTextDataDefault]->_color.r, _texts[kTextDataDefault]->_color.g, _texts[kTextDataDefault]->_color.b);
+ uint32 color = _overlayFormat.RGBToColor(_texts[kTextDataDefault]->_color.r, _texts[kTextDataDefault]->_color.g, _texts[kTextDataDefault]->_color.b);
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;
- format.colorToRGB(src[x], r, g, b);
+ _overlayFormat.colorToRGB(src[x], r, g, b);
const int col = (r << 16) | (g << 8) | b;
// Skip transparency (the transparent color actually is 0xFF00FF,
Modified: scummvm/trunk/gui/ThemeEngine.h
===================================================================
--- scummvm/trunk/gui/ThemeEngine.h 2009-01-22 18:33:02 UTC (rev 36000)
+++ scummvm/trunk/gui/ThemeEngine.h 2009-01-22 18:45:06 UTC (rev 36001)
@@ -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