mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-01 00:12:59 +00:00
Bugfix: Delayed loading of fonts
svn-id: r32993
This commit is contained in:
parent
ccf9368c53
commit
e0aad7f4be
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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()
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user