From 426c81a7a7a4d6f47b73db1a75908b548d250e4e Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 30 Jun 2011 08:16:19 -0400 Subject: GRAPHICS: Rewrite ImageDecoder to have an improved API The new bitmap decoder class is based off the Mohawk one, and now has 8bpp decoding capability. --- gui/ThemeEngine.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 2cb1635e20..bcfd41e05b 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -30,11 +30,11 @@ #include "graphics/cursorman.h" #include "graphics/fontman.h" -#include "graphics/imagedec.h" #include "graphics/surface.h" #include "graphics/VectorRenderer.h" #include "graphics/fonts/bdf.h" #include "graphics/fonts/ttf.h" +#include "graphics/decoders/bmp.h" #include "gui/widget.h" #include "gui/ThemeEngine.h" @@ -620,20 +620,25 @@ bool ThemeEngine::addBitmap(const Common::String &filename) { if (surf) return true; - // If not, try to load the bitmap via the ImageDecoder class. + // If not, try to load the bitmap via the BitmapDecoder class. + Graphics::BitmapDecoder bitmapDecoder; + const Graphics::Surface *srcSurface = 0; Common::ArchiveMemberList members; _themeFiles.listMatchingMembers(members, filename); for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) { Common::SeekableReadStream *stream = (*i)->createReadStream(); if (stream) { - surf = Graphics::ImageDecoder::loadFile(*stream, _overlayFormat); + bitmapDecoder.loadStream(*stream); + srcSurface = bitmapDecoder.getSurface(); delete stream; - - if (surf) + if (srcSurface) break; } } + if (srcSurface && srcSurface->format.bytesPerPixel != 1) + surf = srcSurface->convertTo(_overlayFormat); + // Store the surface into our hashmap (attention, may store NULL entries!) _bitmaps[filename] = surf; -- cgit v1.2.3 From ec32ccb6d640439b71e154c4d48daeb8bd10ff92 Mon Sep 17 00:00:00 2001 From: Oleksiy Kurochko Date: Wed, 22 Feb 2012 17:15:02 +0200 Subject: GUI: Move predictive dialog to common gui --- gui/ThemeEngine.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index bcfd41e05b..fdd7750af9 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -47,6 +47,7 @@ const char * const ThemeEngine::kImageLogo = "logo.bmp"; const char * const ThemeEngine::kImageLogoSmall = "logo_small.bmp"; const char * const ThemeEngine::kImageSearch = "search.bmp"; const char * const ThemeEngine::kImageEraser = "eraser.bmp"; +const char * const ThemeEngine::kImageDelbtn = "delbtn.bmp"; struct TextDrawData { const Graphics::Font *_fontPtr; -- cgit v1.2.3 From e6c317a9226b71af572d2e2004e307c0e895b77c Mon Sep 17 00:00:00 2001 From: Oleksiy Kurochko Date: Thu, 3 May 2012 19:32:08 +0300 Subject: GUI: Implemented pressed state for buttons --- gui/ThemeEngine.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index fdd7750af9..be0a5db601 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -175,6 +175,7 @@ static const DrawDataInfo kDrawDataDefaults[] = { {kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider}, {kDDButtonHover, "button_hover", false, kDDButtonIdle}, {kDDButtonDisabled, "button_disabled", true, kDDNone}, + {kDDButtonPressed, "button_pressed", false, kDDButtonIdle}, {kDDSliderFull, "slider_full", false, kDDNone}, {kDDSliderHover, "slider_hover", false, kDDNone}, @@ -877,6 +878,8 @@ void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, W dd = kDDButtonHover; else if (state == kStateDisabled) dd = kDDButtonDisabled; + else if (state == kStatePressed) + dd = kDDButtonPressed; queueDD(dd, r, 0, hints & WIDGET_CLEARBG); queueDDText(getTextData(dd), getTextColor(dd), r, str, false, true, _widgets[dd]->_textAlignH, _widgets[dd]->_textAlignV); @@ -1125,6 +1128,7 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid break; case kStateEnabled: + case kStatePressed: colorId = kTextColorNormal; break; } @@ -1145,6 +1149,7 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid break; case kStateEnabled: + case kStatePressed: colorId = kTextColorAlternative; break; } -- cgit v1.2.3 From a401f0a19e09d7d00a3ee94d928db82e658b7b48 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sun, 3 Jun 2012 02:02:57 +0200 Subject: ALL: Replace cursorTargetScale in OSystem API with a simple "do not scale" logic. All uses of the old target scale API actually wanted to disallow scaling of the mouse cursor. This commit adapts our API to this and thus simplifies backend implementations. Some backends, most notable the Wii and Android, did some implementation of the cursor target scale, which I didn't adapt yet. I added a TODO for the porters there. --- gui/ThemeEngine.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index be0a5db601..1bf7ad3c85 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -454,7 +454,7 @@ void ThemeEngine::refresh() { if (_useCursor) { CursorMan.replaceCursorPalette(_cursorPal, 0, _cursorPalSize); - CursorMan.replaceCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, _cursorTargetScale); + CursorMan.replaceCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, true); } } } @@ -465,7 +465,7 @@ void ThemeEngine::enable() { if (_useCursor) { CursorMan.pushCursorPalette(_cursorPal, 0, _cursorPalSize); - CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, _cursorTargetScale); + CursorMan.pushCursor(_cursor, _cursorWidth, _cursorHeight, _cursorHotspotX, _cursorHotspotY, 255, true); CursorMan.showMouse(true); } @@ -1287,7 +1287,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) { _vectorRenderer->setSurface(&_screen); } -bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale) { +bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int hotspotY) { if (!_system->hasFeature(OSystem::kFeatureCursorPalette)) return true; @@ -1305,7 +1305,6 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int // Set up the cursor parameters _cursorHotspotX = hotspotX; _cursorHotspotY = hotspotY; - _cursorTargetScale = scale; _cursorWidth = cursor->w; _cursorHeight = cursor->h; -- cgit v1.2.3 From aec9b9e22a9bff54ae3c39bb796bae0f4b4c2d95 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Sat, 16 Jun 2012 04:17:14 +0200 Subject: ALL: Let overlay related methods in OSystem take a void * and use a proper pitch values. This is a first step to get rid of OverlayColor, which is a requirement for proper 4Bpp overlay support. --- gui/ThemeEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 1bf7ad3c85..e37022f5f1 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -429,7 +429,7 @@ bool ThemeEngine::init() { void ThemeEngine::clearAll() { if (_initOk) { _system->clearOverlay(); - _system->grabOverlay((OverlayColor *)_screen.pixels, _screen.w); + _system->grabOverlay(_screen.pixels, _screen.pitch); } } -- cgit v1.2.3 From d3e5763276826d3f469fd93077c2f1ef6ef61314 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Fri, 29 Jun 2012 15:52:56 +0200 Subject: GUI: Allow the user to switch between list and thumbnail based load chooser. --- gui/ThemeEngine.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 1bf7ad3c85..6f34e8dc70 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -48,6 +48,8 @@ const char * const ThemeEngine::kImageLogoSmall = "logo_small.bmp"; const char * const ThemeEngine::kImageSearch = "search.bmp"; const char * const ThemeEngine::kImageEraser = "eraser.bmp"; const char * const ThemeEngine::kImageDelbtn = "delbtn.bmp"; +const char * const ThemeEngine::kImageList = "list.bmp"; +const char * const ThemeEngine::kImageGrid = "grid.bmp"; struct TextDrawData { const Graphics::Font *_fontPtr; -- cgit v1.2.3 From b4196e48b16c458ef6564a051495525ff5a282f0 Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 30 Jul 2012 21:31:14 +0200 Subject: GRAPHICS: Add a DPI parameter to loadTTFFont. Will be used by WME. --- gui/ThemeEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index e37022f5f1..2fff92c263 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1422,7 +1422,7 @@ const Graphics::Font *ThemeEngine::loadScalableFont(const Common::String &filena for (Common::ArchiveMemberList::const_iterator i = members.begin(), end = members.end(); i != end; ++i) { Common::SeekableReadStream *stream = (*i)->createReadStream(); if (stream) { - font = Graphics::loadTTFFont(*stream, pointsize, false, + font = Graphics::loadTTFFont(*stream, pointsize, 0, false, #ifdef USE_TRANSLATION TransMan.getCharsetMapping() #else -- cgit v1.2.3