From 0ccc9189402de806307ca9836196cf29f31b2ab7 Mon Sep 17 00:00:00 2001 From: Joel Teichroeb Date: Sun, 27 Oct 2013 12:42:03 -0700 Subject: GUI: Fix for potential bad cursor palette access in warning case. Previously, if the colorsFound exceeded the maximum number of cursor colors, a bad access to the cursor palette buffer could be performed before the warning was emitted. This reordering avoids that. --- gui/ThemeEngine.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 688654d208..9fe482ddcc 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1360,17 +1360,17 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int // If there is no entry yet for this color in the palette: Add one if (!colorToIndex.contains(col)) { + if (colorsFound >= MAX_CURS_COLORS) { + warning("Cursor contains too many colors (%d, but only %d are allowed)", colorsFound, MAX_CURS_COLORS); + return false; + } + const int index = colorsFound++; colorToIndex[col] = index; _cursorPal[index * 3 + 0] = r; _cursorPal[index * 3 + 1] = g; _cursorPal[index * 3 + 2] = b; - - if (colorsFound > MAX_CURS_COLORS) { - warning("Cursor contains too many colors (%d, but only %d are allowed)", colorsFound, MAX_CURS_COLORS); - return false; - } } // Copy pixel from the 16 bit source surface to the 8bit target surface -- cgit v1.2.3 From 740b6e8fbdece44ae2a5295cb0549a53b6dc6ae7 Mon Sep 17 00:00:00 2001 From: Matthew Hoops Date: Thu, 27 Feb 2014 21:27:23 -0500 Subject: IMAGE: Move all ImageDecoders to image/ --- gui/ThemeEngine.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'gui/ThemeEngine.cpp') diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 9fe482ddcc..9e54597dd4 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -34,7 +34,8 @@ #include "graphics/VectorRenderer.h" #include "graphics/fonts/bdf.h" #include "graphics/fonts/ttf.h" -#include "graphics/decoders/bmp.h" + +#include "image/bmp.h" #include "gui/widget.h" #include "gui/ThemeEngine.h" @@ -638,7 +639,7 @@ bool ThemeEngine::addBitmap(const Common::String &filename) { return true; // If not, try to load the bitmap via the BitmapDecoder class. - Graphics::BitmapDecoder bitmapDecoder; + Image::BitmapDecoder bitmapDecoder; const Graphics::Surface *srcSurface = 0; Common::ArchiveMemberList members; _themeFiles.listMatchingMembers(members, filename); -- cgit v1.2.3 From 5b03ba04d78be0f7d60ac777dbf8b51584192f7d Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Mon, 9 Jun 2014 01:04:47 +0200 Subject: GRAPHICS: Allow client code to specify TTF render mode. This allows clients to use the default FreeType2 render mode instead of light. We really only use light as default because that's what looks best with the font we use in our GUI right now (which is the same reason why formerly light was always used in non-monochrome mode). --- 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 9e54597dd4..ed01204180 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -1446,7 +1446,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, 0, false, + font = Graphics::loadTTFFont(*stream, pointsize, 0, Graphics::kTTFRenderModeLight, #ifdef USE_TRANSLATION TransMan.getCharsetMapping() #else -- cgit v1.2.3