diff options
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/VectorRenderer.cpp | 27 | ||||
-rw-r--r-- | graphics/VectorRenderer.h | 4 |
2 files changed, 16 insertions, 15 deletions
diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index e3e7174d90..17a221a725 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -323,23 +323,24 @@ inline uint32 fp_sqroot(uint32 x) { template <typename PixelType, typename PixelFormat> void VectorRendererSpec<PixelType, PixelFormat>:: drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, - GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) { + GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax, bool ellipsis) { - int offset = 0; + int offset = area.top; - switch (alignV) { - case GUI::Theme::kTextAlignVCenter: - offset = area.top + (area.height() - font->getFontHeight()) / 2; - break; - case GUI::Theme::kTextAlignVBottom: - offset = area.bottom - font->getFontHeight(); - break; - case GUI::Theme::kTextAlignVTop: - offset = area.top; - break; + if (font->getFontHeight() < area.height()) { + switch (alignV) { + case GUI::Theme::kTextAlignVCenter: + offset = area.top + ((area.height() - font->getFontHeight()) >> 1); + break; + case GUI::Theme::kTextAlignVBottom: + offset = area.bottom - font->getFontHeight(); + break; + default: + break; + } } - font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, deltax, false); + font->drawString(_activeSurface, text, area.left, offset, area.width(), _fgColor, (Graphics::TextAlignment)alignH, deltax, ellipsis); } /** LINES **/ diff --git a/graphics/VectorRenderer.h b/graphics/VectorRenderer.h index 7eff0a9c50..13ba9ff480 100644 --- a/graphics/VectorRenderer.h +++ b/graphics/VectorRenderer.h @@ -477,7 +477,7 @@ public: * Draws a string into the screen. Wrapper for the Graphics::Font string drawing * method. */ - virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax) = 0; + virtual void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, GUI::Theme::TextAlignVertical alignV, int deltax, bool useEllipsis) = 0; /** * Allows to temporarily enable/disable all shadows drawing. @@ -604,7 +604,7 @@ public: void drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area, GUI::Theme::TextAlign alignH, - GUI::Theme::TextAlignVertical alignV, int deltax); + GUI::Theme::TextAlignVertical alignV, int deltax, bool elipsis); /** * @see VectorRenderer::setFgColor() |