aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/VectorRenderer.cpp3
-rw-r--r--graphics/VectorRenderer.h6
-rw-r--r--gui/ThemeRenderer.cpp13
-rw-r--r--gui/ThemeRenderer.h1
4 files changed, 17 insertions, 6 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp
index daeeb43f69..0c1d01213d 100644
--- a/graphics/VectorRenderer.cpp
+++ b/graphics/VectorRenderer.cpp
@@ -75,7 +75,6 @@ void VectorRenderer::textStep(const Common::String &text, const Common::Rect &ar
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 @@ inline uint32 fp_sqroot(uint32 x) {
********************************************************************/
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);
}
diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h
index 402c76a55c..9b5481cddf 100644
--- a/graphics/VectorRenderer.h
+++ b/graphics/VectorRenderer.h
@@ -48,7 +48,7 @@ struct TextStep {
GUI::Theme::TextAlign align;
char *text;
- Graphics::Font *font;
+ const Graphics::Font *font;
};
struct DrawStep {
@@ -446,7 +446,7 @@ public:
*/
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 @@ public:
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()
diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp
index 71943e2586..ca686b8583 100644
--- a/gui/ThemeRenderer.cpp
+++ b/gui/ThemeRenderer.cpp
@@ -188,6 +188,7 @@ bool ThemeRenderer::addTextStep(Common::String &drawDataId, Graphics::TextStep s
return false;
_widgets[id]->_textStep = step;
+ _widgets[id]->_textStep.font = 0;
_widgets[id]->_hasText = true;
return true;
@@ -278,11 +279,20 @@ void ThemeRenderer::drawDD(DrawData type, const Common::Rect &r) {
}
}
+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 @@ void ThemeRenderer::drawButton(const Common::Rect &r, const Common::String &str,
dd = kDDButtonDisabled;
drawDD(dd, r);
+ drawDDText(dd, r, str);
if (hasWidgetText(dd))
_vectorRenderer->textStep(str, r, _widgets[dd]->_textStep);
diff --git a/gui/ThemeRenderer.h b/gui/ThemeRenderer.h
index 74225d035c..f2e30bae09 100644
--- a/gui/ThemeRenderer.h
+++ b/gui/ThemeRenderer.h
@@ -238,6 +238,7 @@ protected:
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