[Scummvm-cvs-logs] SF.net SVN: scummvm: [32993] scummvm/branches/gsoc2008-gui
Tanoku at users.sourceforge.net
Tanoku at users.sourceforge.net
Thu Jul 10 18:37:46 CEST 2008
Revision: 32993
http://scummvm.svn.sourceforge.net/scummvm/?rev=32993&view=rev
Author: Tanoku
Date: 2008-07-10 09:37:45 -0700 (Thu, 10 Jul 2008)
Log Message:
-----------
Bugfix: Delayed loading of fonts
Modified Paths:
--------------
scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp 2008-07-10 16:19:17 UTC (rev 32992)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.cpp 2008-07-10 16:37:45 UTC (rev 32993)
@@ -75,7 +75,6 @@
if (step.color.set)
setFgColor(step.color.r, step.color.g, step.color.b);
- assert(step.font);
drawString(step.font, text.c_str(), area, step.align);
}
@@ -186,7 +185,7 @@
********************************************************************/
template <typename PixelType, typename PixelFormat>
void VectorRendererSpec<PixelType, PixelFormat>::
-drawString(Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign align) {
+drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign align) {
font->drawString(_activeSurface, text, area.left, area.top, area.width(), _fgColor, (Graphics::TextAlignment)align, 0, false);
}
Modified: scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h 2008-07-10 16:19:17 UTC (rev 32992)
+++ scummvm/branches/gsoc2008-gui/graphics/VectorRenderer.h 2008-07-10 16:37:45 UTC (rev 32993)
@@ -48,7 +48,7 @@
GUI::Theme::TextAlign align;
char *text;
- Graphics::Font *font;
+ const Graphics::Font *font;
};
struct DrawStep {
@@ -446,7 +446,7 @@
*/
virtual void blitSurface(Graphics::Surface *source, const Common::Rect &r) = 0;
- virtual void drawString(Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign align) = 0;
+ virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign align) = 0;
protected:
Surface *_activeSurface; /** Pointer to the surface currently being drawn */
@@ -513,7 +513,7 @@
drawBevelSquareAlg(x, y, w, h, bevel, _fgColor, _bgColor);
}
- void drawString(Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign align);
+ void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign align);
/**
* @see VectorRenderer::setFgColor()
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp 2008-07-10 16:19:17 UTC (rev 32992)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.cpp 2008-07-10 16:37:45 UTC (rev 32993)
@@ -188,6 +188,7 @@
return false;
_widgets[id]->_textStep = step;
+ _widgets[id]->_textStep.font = 0;
_widgets[id]->_hasText = true;
return true;
@@ -278,11 +279,20 @@
}
}
+void ThemeRenderer::drawDDText(DrawData type, const Common::Rect &r, const Common::String &text) {
+ if (hasWidgetText(type)) {
+ if (_widgets[type]->_textStep.font == 0)
+ _widgets[type]->_textStep.font = _font;
+
+ _vectorRenderer->textStep(text, r, _widgets[type]->_textStep);
+ }
+}
+
void ThemeRenderer::drawButton(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, uint16 hints) {
if (!ready())
return;
- DrawData dd;
+ DrawData dd = kDDButtonIdle;
if (state == kStateEnabled)
dd = kDDButtonIdle;
@@ -292,6 +302,7 @@
dd = kDDButtonDisabled;
drawDD(dd, r);
+ drawDDText(dd, r, str);
if (hasWidgetText(dd))
_vectorRenderer->textStep(str, r, _widgets[dd]->_textStep);
Modified: scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h
===================================================================
--- scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h 2008-07-10 16:19:17 UTC (rev 32992)
+++ scummvm/branches/gsoc2008-gui/gui/ThemeRenderer.h 2008-07-10 16:37:45 UTC (rev 32993)
@@ -238,6 +238,7 @@
void drawCached(DrawData type, const Common::Rect &r);
inline void drawDD(DrawData type, const Common::Rect &r);
+ inline void drawDDText(DrawData type, const Common::Rect &r, const Common::String &text);
inline void debugWidgetPosition(const Common::Rect &r);
// TODO
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list