Fix buggy images in GUI when switching overlay mode (e.g. on Mac OS X when toggline full screen and windowed mode)
svn-id: r36001
This commit is contained in:
parent
6692330c41
commit
cc1efb9137
2 changed files with 18 additions and 4 deletions
|
@ -362,6 +362,7 @@ bool ThemeEngine::init() {
|
||||||
// reset everything and reload the graphics
|
// reset everything and reload the graphics
|
||||||
_initOk = false;
|
_initOk = false;
|
||||||
setGraphicsMode(_graphicsMode);
|
setGraphicsMode(_graphicsMode);
|
||||||
|
_overlayFormat = _system->getOverlayFormat();
|
||||||
|
|
||||||
if (_screen.pixels && _backBuffer.pixels) {
|
if (_screen.pixels && _backBuffer.pixels) {
|
||||||
_initOk = true;
|
_initOk = true;
|
||||||
|
@ -414,7 +415,21 @@ void ThemeEngine::clearAll() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThemeEngine::refresh() {
|
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();
|
init();
|
||||||
|
|
||||||
if (_enabled) {
|
if (_enabled) {
|
||||||
_system->showOverlay();
|
_system->showOverlay();
|
||||||
|
|
||||||
|
@ -1040,8 +1055,7 @@ void ThemeEngine::drawChar(const Common::Rect &r, byte ch, const Graphics::Font
|
||||||
Common::Rect charArea = r;
|
Common::Rect charArea = r;
|
||||||
charArea.clip(_screen.w, _screen.h);
|
charArea.clip(_screen.w, _screen.h);
|
||||||
|
|
||||||
Graphics::PixelFormat format = _system->getOverlayFormat();
|
uint32 color = _overlayFormat.RGBToColor(_texts[kTextDataDefault]->_color.r, _texts[kTextDataDefault]->_color.g, _texts[kTextDataDefault]->_color.b);
|
||||||
uint32 color = format.RGBToColor(_texts[kTextDataDefault]->_color.r, _texts[kTextDataDefault]->_color.g, _texts[kTextDataDefault]->_color.b);
|
|
||||||
|
|
||||||
restoreBackground(charArea);
|
restoreBackground(charArea);
|
||||||
font->drawChar(&_screen, ch, charArea.left, charArea.top, color);
|
font->drawChar(&_screen, ch, charArea.left, charArea.top, color);
|
||||||
|
@ -1146,11 +1160,10 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int
|
||||||
uint colorsFound = 0;
|
uint colorsFound = 0;
|
||||||
Common::HashMap<int, int> colorToIndex;
|
Common::HashMap<int, int> colorToIndex;
|
||||||
const OverlayColor *src = (const OverlayColor*)cursor->pixels;
|
const OverlayColor *src = (const OverlayColor*)cursor->pixels;
|
||||||
Graphics::PixelFormat format = _system->getOverlayFormat();
|
|
||||||
for (uint y = 0; y < _cursorHeight; ++y) {
|
for (uint y = 0; y < _cursorHeight; ++y) {
|
||||||
for (uint x = 0; x < _cursorWidth; ++x) {
|
for (uint x = 0; x < _cursorWidth; ++x) {
|
||||||
byte r, g, b;
|
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;
|
const int col = (r << 16) | (g << 8) | b;
|
||||||
|
|
||||||
// Skip transparency (the transparent color actually is 0xFF00FF,
|
// Skip transparency (the transparent color actually is 0xFF00FF,
|
||||||
|
|
|
@ -584,6 +584,7 @@ protected:
|
||||||
TextDrawData *_texts[kTextDataMAX];
|
TextDrawData *_texts[kTextDataMAX];
|
||||||
|
|
||||||
ImagesMap _bitmaps;
|
ImagesMap _bitmaps;
|
||||||
|
Graphics::PixelFormat _overlayFormat;
|
||||||
|
|
||||||
/** List of all the dirty screens that must be blitted to the overlay. */
|
/** List of all the dirty screens that must be blitted to the overlay. */
|
||||||
Common::List<Common::Rect> _dirtyScreen;
|
Common::List<Common::Rect> _dirtyScreen;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue