diff options
author | Vicent Marti | 2008-08-10 18:56:10 +0000 |
---|---|---|
committer | Vicent Marti | 2008-08-10 18:56:10 +0000 |
commit | 52f3551587aad266a794e69416a9662023e55e0f (patch) | |
tree | c4e58c343e33a9094b2a1fa7fa30fc20b25a9329 /graphics | |
parent | b2bac41d0ed98f4f69a9a9232d7a373d76ef1e39 (diff) | |
download | scummvm-rg350-52f3551587aad266a794e69416a9662023e55e0f.tar.gz scummvm-rg350-52f3551587aad266a794e69416a9662023e55e0f.tar.bz2 scummvm-rg350-52f3551587aad266a794e69416a9662023e55e0f.zip |
Bugfix: Several text-drawing issues.
Bugfix: Overlapping text in text edit dialogs.
svn-id: r33768
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() |