Bugfix: Several text-drawing issues.
Bugfix: Overlapping text in text edit dialogs. svn-id: r33768
This commit is contained in:
parent
b2bac41d0e
commit
52f3551587
6 changed files with 24 additions and 26 deletions
|
@ -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 **/
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -407,7 +407,7 @@ void ListWidget::drawWidget() {
|
|||
if (_selectedItem != pos) {
|
||||
width = g_gui.getStringWidth(buffer) + pad;
|
||||
if (width > _w - r.left)
|
||||
width = _w - r.left;
|
||||
width = _w - r.left - _hlRightPadding - _scrollBarWidth;
|
||||
} else
|
||||
width = _w - r.left - _hlRightPadding - _scrollBarWidth;
|
||||
if (width > maxWidth)
|
||||
|
|
|
@ -552,7 +552,7 @@ void ThemeRenderer::drawDDText(const DrawQueueText &q) {
|
|||
restoreBackground(q.area);
|
||||
|
||||
_vectorRenderer->setFgColor(_texts[q.type]->_color.r, _texts[q.type]->_color.g, _texts[q.type]->_color.b);
|
||||
_vectorRenderer->drawString(_texts[q.type]->_fontPtr, q.text, q.area, q.alignH, q.alignV, q.deltax);
|
||||
_vectorRenderer->drawString(_texts[q.type]->_fontPtr, q.text, q.area, q.alignH, q.alignV, q.deltax, q.elipsis);
|
||||
addDirtyRect(q.area);
|
||||
}
|
||||
|
||||
|
@ -781,18 +781,15 @@ void ThemeRenderer::drawText(const Common::Rect &r, const Common::String &str, W
|
|||
if (!ready())
|
||||
return;
|
||||
|
||||
Common::Rect dr = r;
|
||||
dr.left += deltax;
|
||||
|
||||
if (inverted) {
|
||||
queueDD(kDDTextSelectionBackground, r);
|
||||
queueDDText(kTextDataInverted, dr, str, false, useEllipsis, align);
|
||||
queueDDText(kTextDataInverted, r, str, false, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||
return;
|
||||
}
|
||||
|
||||
switch (font) {
|
||||
case kFontStyleNormal:
|
||||
queueDDText(kTextDataNormalFont, dr, str, true, useEllipsis, align);
|
||||
queueDDText(kTextDataNormalFont, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||
return;
|
||||
|
||||
default:
|
||||
|
@ -801,15 +798,15 @@ void ThemeRenderer::drawText(const Common::Rect &r, const Common::String &str, W
|
|||
|
||||
switch (state) {
|
||||
case kStateDisabled:
|
||||
queueDDText(kTextDataDisabled, dr, str, true, useEllipsis, align);
|
||||
queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||
return;
|
||||
|
||||
case kStateHighlight:
|
||||
queueDDText(kTextDataHover, dr, str, true, useEllipsis, align);
|
||||
queueDDText(kTextDataHover, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||
return;
|
||||
|
||||
case kStateEnabled:
|
||||
queueDDText(kTextDataDefault, dr, str, true, useEllipsis, align);
|
||||
queueDDText(kTextDataDefault, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ protected:
|
|||
friend class GUI::GuiObject;
|
||||
|
||||
/** Constant value to expand dirty rectangles, to make sure they are fully copied */
|
||||
static const int kDirtyRectangleThreshold = 2;
|
||||
static const int kDirtyRectangleThreshold = 0;
|
||||
|
||||
/** Sets whether backcaching is enabled */
|
||||
static const bool kEnableBackCaching = true;
|
||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue