diff options
author | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-01-26 21:00:03 +0000 |
---|---|---|
committer | Bjørn Lindeijer <bjorn@lindeijer.nl> | 2008-01-26 21:00:03 +0000 |
commit | 0962fc8b567279a6e97e13e4b3f2f9f2ffe304c0 (patch) | |
tree | 52ca5a6b6ee9a1d6ed01c11129a86f5b507d9761 | |
parent | 89a1dcb59be3e531cc0761c32d1aa70e141d4a12 (diff) | |
download | mana-client-0962fc8b567279a6e97e13e4b3f2f9f2ffe304c0.tar.gz mana-client-0962fc8b567279a6e97e13e4b3f2f9f2ffe304c0.tar.bz2 mana-client-0962fc8b567279a6e97e13e4b3f2f9f2ffe304c0.tar.xz mana-client-0962fc8b567279a6e97e13e4b3f2f9f2ffe304c0.zip |
Image alpha should also be set to 1, in case it was changed before.
-rw-r--r-- | ChangeLog | 20 | ||||
-rw-r--r-- | src/gui/truetypefont.cpp | 14 | ||||
-rw-r--r-- | src/gui/truetypefont.h | 2 |
3 files changed, 21 insertions, 15 deletions
@@ -1,23 +1,29 @@ -2007-01-26 Philipp Sehmisch <tmw@crushnet.org> +2008-01-26 Bjørn Lindeijer <bjorn@lindeijer.nl> + + * src/gui/truetypefont.cpp: Image alpha should also be set to 1, in + case it was changed before. + * src/gui/truetypefont.h: Corrected documentation. + +2008-01-26 Philipp Sehmisch <tmw@crushnet.org> * scr/gui/truetypefont.cpp: Added support for alpha blending to true type font rendering. -2007-01-24 Philipp Sehmisch <tmw@crushnet.org> +2008-01-24 Philipp Sehmisch <tmw@crushnet.org> * src/net/beinghandler.cpp, src/resources/spritedef.h: Fixed broken communication of attack directions. -2007-01-20 Philipp Sehmisch <tmw@crushnet.org> +2008-01-20 Philipp Sehmisch <tmw@crushnet.org> * data/items.xml: Added max-per-slot property to all items. -2007-01-19 Philipp Sehmisch <tmw@crushnet.org> +2008-01-19 Philipp Sehmisch <tmw@crushnet.org> * src/resources/itemdb.cpp: Fixed interpretation of weapon types in items.xml. -2007-01-10 Philipp Sehmisch <tmw@crushnet.org> +2008-01-10 Philipp Sehmisch <tmw@crushnet.org> * src/resources/itemdb.cpp, src/resources/iteminfo.cpp, src/resources/iteminfo.h: Item types and weapon types are now @@ -27,12 +33,12 @@ weapon-type properties to all items. All healing items now have a healing effect. -2007-01-09 Philipp Sehmisch <tmw@crushnet.org> +2008-01-09 Philipp Sehmisch <tmw@crushnet.org> * data/items.xml: Added weapon_type properties to weapons so that attack animations are displayed properly. -2007-01-07 Philipp Sehmisch <tmw@crushnet.org> +2008-01-07 Philipp Sehmisch <tmw@crushnet.org> * src/localplayer.h: Implemented new attribute enumerations of last server update. diff --git a/src/gui/truetypefont.cpp b/src/gui/truetypefont.cpp index 82c55413..7f9abd3a 100644 --- a/src/gui/truetypefont.cpp +++ b/src/gui/truetypefont.cpp @@ -35,7 +35,7 @@ class TextChunk { public: - TextChunk(const std::string &text, gcn::Color color) : + TextChunk(const std::string &text, const gcn::Color &color) : img(NULL), text(text), color(color) { } @@ -130,12 +130,12 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, } gcn::Color col = g->getColor(); - float alpha = 1.0f; - if (col.a != 255) alpha = col.a / 255.0f; - col.a = 255; - /* alpha value is ignored at sting generation so it makes no sense to - * cache the same text with different alpha values. + const float alpha = col.a / 255.0f; + + /* The alpha value is ignored at string generation so avoid caching the + * same text with different alpha values. */ + col.a = 255; TextChunk chunk(text, col); @@ -163,7 +163,7 @@ void TrueTypeFont::drawString(gcn::Graphics *graphics, cache.front().generate(mFont); } - if (alpha != 1.0f) cache.front().img->setAlpha(alpha); + cache.front().img->setAlpha(alpha); g->drawImage(cache.front().img, x, y); } diff --git a/src/gui/truetypefont.h b/src/gui/truetypefont.h index d496d82e..7a4ee9ac 100644 --- a/src/gui/truetypefont.h +++ b/src/gui/truetypefont.h @@ -33,7 +33,7 @@ /** * A wrapper around SDL_ttf for allowing the use of TrueType fonts. * - * <b>NOTE:</b> This class needs SDL_ttf to be initialized. + * <b>NOTE:</b> This class initializes SDL_ttf as necessary. */ class TrueTypeFont : public gcn::Font { |