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>
|
template <typename PixelType, typename PixelFormat>
|
||||||
void VectorRendererSpec<PixelType, PixelFormat>::
|
void VectorRendererSpec<PixelType, PixelFormat>::
|
||||||
drawString(const Graphics::Font *font, const Common::String &text, const Common::Rect &area,
|
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;
|
||||||
|
|
||||||
|
if (font->getFontHeight() < area.height()) {
|
||||||
switch (alignV) {
|
switch (alignV) {
|
||||||
case GUI::Theme::kTextAlignVCenter:
|
case GUI::Theme::kTextAlignVCenter:
|
||||||
offset = area.top + (area.height() - font->getFontHeight()) / 2;
|
offset = area.top + ((area.height() - font->getFontHeight()) >> 1);
|
||||||
break;
|
break;
|
||||||
case GUI::Theme::kTextAlignVBottom:
|
case GUI::Theme::kTextAlignVBottom:
|
||||||
offset = area.bottom - font->getFontHeight();
|
offset = area.bottom - font->getFontHeight();
|
||||||
break;
|
break;
|
||||||
case GUI::Theme::kTextAlignVTop:
|
default:
|
||||||
offset = area.top;
|
|
||||||
break;
|
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 **/
|
/** LINES **/
|
||||||
|
|
|
@ -477,7 +477,7 @@ public:
|
||||||
* Draws a string into the screen. Wrapper for the Graphics::Font string drawing
|
* Draws a string into the screen. Wrapper for the Graphics::Font string drawing
|
||||||
* method.
|
* 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.
|
* Allows to temporarily enable/disable all shadows drawing.
|
||||||
|
@ -604,7 +604,7 @@ public:
|
||||||
|
|
||||||
void drawString(const Graphics::Font *font, const Common::String &text,
|
void drawString(const Graphics::Font *font, const Common::String &text,
|
||||||
const Common::Rect &area, GUI::Theme::TextAlign alignH,
|
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()
|
* @see VectorRenderer::setFgColor()
|
||||||
|
|
|
@ -407,7 +407,7 @@ void ListWidget::drawWidget() {
|
||||||
if (_selectedItem != pos) {
|
if (_selectedItem != pos) {
|
||||||
width = g_gui.getStringWidth(buffer) + pad;
|
width = g_gui.getStringWidth(buffer) + pad;
|
||||||
if (width > _w - r.left)
|
if (width > _w - r.left)
|
||||||
width = _w - r.left;
|
width = _w - r.left - _hlRightPadding - _scrollBarWidth;
|
||||||
} else
|
} else
|
||||||
width = _w - r.left - _hlRightPadding - _scrollBarWidth;
|
width = _w - r.left - _hlRightPadding - _scrollBarWidth;
|
||||||
if (width > maxWidth)
|
if (width > maxWidth)
|
||||||
|
|
|
@ -552,7 +552,7 @@ void ThemeRenderer::drawDDText(const DrawQueueText &q) {
|
||||||
restoreBackground(q.area);
|
restoreBackground(q.area);
|
||||||
|
|
||||||
_vectorRenderer->setFgColor(_texts[q.type]->_color.r, _texts[q.type]->_color.g, _texts[q.type]->_color.b);
|
_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);
|
addDirtyRect(q.area);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -781,18 +781,15 @@ void ThemeRenderer::drawText(const Common::Rect &r, const Common::String &str, W
|
||||||
if (!ready())
|
if (!ready())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Common::Rect dr = r;
|
|
||||||
dr.left += deltax;
|
|
||||||
|
|
||||||
if (inverted) {
|
if (inverted) {
|
||||||
queueDD(kDDTextSelectionBackground, r);
|
queueDD(kDDTextSelectionBackground, r);
|
||||||
queueDDText(kTextDataInverted, dr, str, false, useEllipsis, align);
|
queueDDText(kTextDataInverted, r, str, false, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (font) {
|
switch (font) {
|
||||||
case kFontStyleNormal:
|
case kFontStyleNormal:
|
||||||
queueDDText(kTextDataNormalFont, dr, str, true, useEllipsis, align);
|
queueDDText(kTextDataNormalFont, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -801,15 +798,15 @@ void ThemeRenderer::drawText(const Common::Rect &r, const Common::String &str, W
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case kStateDisabled:
|
case kStateDisabled:
|
||||||
queueDDText(kTextDataDisabled, dr, str, true, useEllipsis, align);
|
queueDDText(kTextDataDisabled, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case kStateHighlight:
|
case kStateHighlight:
|
||||||
queueDDText(kTextDataHover, dr, str, true, useEllipsis, align);
|
queueDDText(kTextDataHover, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case kStateEnabled:
|
case kStateEnabled:
|
||||||
queueDDText(kTextDataDefault, dr, str, true, useEllipsis, align);
|
queueDDText(kTextDataDefault, r, str, true, useEllipsis, align, kTextAlignVCenter, deltax);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,7 +94,7 @@ protected:
|
||||||
friend class GUI::GuiObject;
|
friend class GUI::GuiObject;
|
||||||
|
|
||||||
/** Constant value to expand dirty rectangles, to make sure they are fully copied */
|
/** 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 */
|
/** Sets whether backcaching is enabled */
|
||||||
static const bool kEnableBackCaching = true;
|
static const bool kEnableBackCaching = true;
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue