diff options
Diffstat (limited to 'gui')
-rw-r--r-- | gui/EventRecorder.cpp | 10 | ||||
-rw-r--r-- | gui/EventRecorder.h | 2 | ||||
-rw-r--r-- | gui/ThemeEngine.cpp | 48 | ||||
-rw-r--r-- | gui/ThemeEngine.h | 4 | ||||
-rw-r--r-- | gui/widget.cpp | 10 |
5 files changed, 43 insertions, 31 deletions
diff --git a/gui/EventRecorder.cpp b/gui/EventRecorder.cpp index fd0093d266..21152dd079 100644 --- a/gui/EventRecorder.cpp +++ b/gui/EventRecorder.cpp @@ -372,8 +372,8 @@ SdlMixerManager *EventRecorder::getMixerManager() { } } -void EventRecorder::getConfigFromDomain(Common::ConfigManager::Domain *domain) { - for (Common::ConfigManager::Domain::iterator entry = domain->begin(); entry!= domain->end(); ++entry) { +void EventRecorder::getConfigFromDomain(const Common::ConfigManager::Domain *domain) { + for (Common::ConfigManager::Domain::const_iterator entry = domain->begin(); entry!= domain->end(); ++entry) { _playbackFile->getHeader().settingsRecords[entry->_key] = entry->_value; } } @@ -386,7 +386,7 @@ void EventRecorder::getConfig() { void EventRecorder::applyPlaybackSettings() { - for (Common::StringMap::iterator i = _playbackFile->getHeader().settingsRecords.begin(); i != _playbackFile->getHeader().settingsRecords.end(); ++i) { + for (Common::StringMap::const_iterator i = _playbackFile->getHeader().settingsRecords.begin(); i != _playbackFile->getHeader().settingsRecords.end(); ++i) { Common::String currentValue = ConfMan.get(i->_key); if (currentValue != i->_value) { ConfMan.set(i->_key, i->_value, ConfMan.kTransientDomain); @@ -400,7 +400,7 @@ void EventRecorder::applyPlaybackSettings() { } void EventRecorder::removeDifferentEntriesInDomain(Common::ConfigManager::Domain *domain) { - for (Common::ConfigManager::Domain::iterator entry = domain->begin(); entry!= domain->end(); ++entry) { + for (Common::ConfigManager::Domain::const_iterator entry = domain->begin(); entry!= domain->end(); ++entry) { if (_playbackFile->getHeader().settingsRecords.find(entry->_key) == _playbackFile->getHeader().settingsRecords.end()) { debugC(1, kDebugLevelEventRec, "playback:action=\"Apply settings\" checksettings:key=%s storedvalue=%s currentvalue="" result=different", entry->_key.c_str(), entry->_value.c_str()); domain->erase(entry->_key); @@ -522,7 +522,7 @@ bool EventRecorder::grabScreenAndComputeMD5(Graphics::Surface &screen, uint8 md5 warning("Can't save screenshot"); return false; } - Common::MemoryReadStream bitmapStream((const byte*)screen.pixels, screen.w * screen.h * screen.format.bytesPerPixel); + Common::MemoryReadStream bitmapStream((const byte*)screen.getPixels(), screen.w * screen.h * screen.format.bytesPerPixel); computeStreamMD5(bitmapStream, md5); return true; } diff --git a/gui/EventRecorder.h b/gui/EventRecorder.h index 68ffe16fbc..b2a549ece8 100644 --- a/gui/EventRecorder.h +++ b/gui/EventRecorder.h @@ -199,7 +199,7 @@ private: void setFileHeader(); void setGameMd5(const ADGameDescription *gameDesc); void getConfig(); - void getConfigFromDomain(Common::ConfigManager::Domain *domain); + void getConfigFromDomain(const Common::ConfigManager::Domain *domain); void removeDifferentEntriesInDomain(Common::ConfigManager::Domain *domain); void applyPlaybackSettings(); diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 3ce043cb39..561c0244a2 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -343,9 +343,9 @@ ThemeEngine::~ThemeEngine() { *********************************************************/ const ThemeEngine::Renderer ThemeEngine::_rendererModes[] = { { _s("Disabled GFX"), _sc("Disabled GFX", "lowres"), "none", kGfxDisabled }, - { _s("Standard Renderer (16bpp)"), _s("Standard (16bpp)"), "normal_16bpp", kGfxStandard16bit }, + { _s("Standard Renderer"), _s("Standard"), "normal", kGfxStandard }, #ifndef DISABLE_FANCY_THEMES - { _s("Antialiased Renderer (16bpp)"), _s("Antialiased (16bpp)"), "aa_16bpp", kGfxAntialias16bit } + { _s("Antialiased Renderer"), _s("Antialiased"), "antialias", kGfxAntialias } #endif }; @@ -353,9 +353,9 @@ const uint ThemeEngine::_rendererModesSize = ARRAYSIZE(ThemeEngine::_rendererMod const ThemeEngine::GraphicsMode ThemeEngine::_defaultRendererMode = #ifndef DISABLE_FANCY_THEMES - ThemeEngine::kGfxAntialias16bit; + ThemeEngine::kGfxAntialias; #else - ThemeEngine::kGfxStandard16bit; + ThemeEngine::kGfxStandard; #endif ThemeEngine::GraphicsMode ThemeEngine::findMode(const Common::String &cfg) { @@ -389,7 +389,7 @@ bool ThemeEngine::init() { _overlayFormat = _system->getOverlayFormat(); setGraphicsMode(_graphicsMode); - if (_screen.pixels && _backBuffer.pixels) { + if (_screen.getPixels() && _backBuffer.getPixels()) { _initOk = true; } @@ -439,7 +439,7 @@ bool ThemeEngine::init() { void ThemeEngine::clearAll() { if (_initOk) { _system->clearOverlay(); - _system->grabOverlay(_screen.pixels, _screen.pitch); + _system->grabOverlay(_screen.getPixels(), _screen.pitch); } } @@ -494,13 +494,17 @@ void ThemeEngine::disable() { void ThemeEngine::setGraphicsMode(GraphicsMode mode) { switch (mode) { - case kGfxStandard16bit: + case kGfxStandard: #ifndef DISABLE_FANCY_THEMES - case kGfxAntialias16bit: + case kGfxAntialias: #endif - _bytesPerPixel = sizeof(uint16); - break; - + if (g_system->getOverlayFormat().bytesPerPixel == 4) { + _bytesPerPixel = sizeof(uint32); + break; + } else if (g_system->getOverlayFormat().bytesPerPixel == 2) { + _bytesPerPixel = sizeof(uint16); + break; + } default: error("Invalid graphics mode"); } @@ -1219,7 +1223,7 @@ void ThemeEngine::updateScreen(bool render) { } _vectorRenderer->setSurface(&_screen); - memcpy(_screen.getBasePtr(0, 0), _backBuffer.getBasePtr(0, 0), _screen.pitch * _screen.h); + memcpy(_screen.getPixels(), _backBuffer.getPixels(), _screen.pitch * _screen.h); _bufferQueue.clear(); } @@ -1287,7 +1291,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) { addDirtyRect(Common::Rect(0, 0, _screen.w, _screen.h)); } - memcpy(_backBuffer.getBasePtr(0, 0), _screen.getBasePtr(0, 0), _screen.pitch * _screen.h); + memcpy(_backBuffer.getPixels(), _screen.getPixels(), _screen.pitch * _screen.h); _vectorRenderer->setSurface(&_screen); } @@ -1320,22 +1324,31 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int memset(_cursor, 0xFF, sizeof(byte) * _cursorWidth * _cursorHeight); // the transparent color is 0xFF00FF - const int colTransparent = _overlayFormat.RGBToColor(0xFF, 0, 0xFF); + const uint32 colTransparent = _overlayFormat.RGBToColor(0xFF, 0, 0xFF); // Now, scan the bitmap. We have to convert it from 16 bit color mode // to 8 bit mode, and have to create a suitable palette on the fly. uint colorsFound = 0; Common::HashMap<int, int> colorToIndex; - const OverlayColor *src = (const OverlayColor *)cursor->pixels; + const byte *src = (const byte *)cursor->getPixels(); for (uint y = 0; y < _cursorHeight; ++y) { for (uint x = 0; x < _cursorWidth; ++x) { + uint32 color = colTransparent; byte r, g, b; + if (cursor->format.bytesPerPixel == 2) { + color = READ_UINT16(src); + } else if (cursor->format.bytesPerPixel == 4) { + color = READ_UINT32(src); + } + + src += cursor->format.bytesPerPixel; + // Skip transparency - if (src[x] == colTransparent) + if (color == colTransparent) continue; - _overlayFormat.colorToRGB(src[x], r, g, b); + cursor->format.colorToRGB(color, r, g, b); const int col = (r << 16) | (g << 8) | b; // If there is no entry yet for this color in the palette: Add one @@ -1357,7 +1370,6 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int const int index = colorToIndex[col]; _cursor[y * _cursorWidth + x] = index; } - src += _cursorWidth; } _useCursor = true; diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index 160ceb3259..c0e47a19e6 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -250,8 +250,8 @@ public: */ enum GraphicsMode { kGfxDisabled = 0, ///< No GFX - kGfxStandard16bit, ///< 2BPP with the standard (aliased) renderer. - kGfxAntialias16bit ///< 2BPP with the optimized AA renderer. + kGfxStandard, ///< Standard (aliased) renderer. + kGfxAntialias ///< Optimized AA renderer. }; /** Constant value to expand dirty rectangles, to make sure they are fully copied */ diff --git a/gui/widget.cpp b/gui/widget.cpp index c3f10a861f..e96b62e359 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -287,7 +287,7 @@ ButtonWidget::ButtonWidget(GuiObject *boss, int x, int y, int w, int h, const Co ButtonWidget::ButtonWidget(GuiObject *boss, const Common::String &name, const Common::String &label, const char *tooltip, uint32 cmd, uint8 hotkey) : StaticTextWidget(boss, name, cleanupHotkey(label), tooltip), CommandSender(boss), - _cmd(cmd), _lastTime(0) { + _cmd(cmd), _hotkey(hotkey), _lastTime(0) { if (hotkey == 0) _hotkey = parseHotkey(label); setFlags(WIDGET_ENABLED/* | WIDGET_BORDER*/ | WIDGET_CLEARBG); @@ -396,7 +396,7 @@ PicButtonWidget::~PicButtonWidget() { void PicButtonWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); - if (!gfx || !gfx->pixels) + if (!gfx || !gfx->getPixels()) return; if (gfx->format.bytesPerPixel == 1) { @@ -429,7 +429,7 @@ void PicButtonWidget::setGfx(int w, int h, int r, int g, int b) { void PicButtonWidget::drawWidget() { g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags()); - if (_gfx.pixels) { + if (_gfx.getPixels()) { // Check whether the set up surface needs to be converted to the GUI // color format. const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); @@ -646,7 +646,7 @@ GraphicsWidget::~GraphicsWidget() { void GraphicsWidget::setGfx(const Graphics::Surface *gfx) { _gfx.free(); - if (!gfx || !gfx->pixels) + if (!gfx || !gfx->getPixels()) return; if (gfx->format.bytesPerPixel == 1) { @@ -676,7 +676,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { } void GraphicsWidget::drawWidget() { - if (_gfx.pixels) { + if (_gfx.getPixels()) { // Check whether the set up surface needs to be converted to the GUI // color format. const Graphics::PixelFormat &requiredFormat = g_gui.theme()->getPixelFormat(); |