Fix text decoration width rounding

width passed in qreal should be set with setWidthF instead of
setWidth, otherwise the fractional part is lost.

Also remove the raster paint engine hack that has been removed in
Qt 4.8, it's no longer needed.

This fixed the drawUnderline and drawRightToLeft auto tests in
tst_qglyphrun.

Change-Id: Iace46fc27ff156c07fb4d08a145269fad36e9fdb
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Jiang Jiang 2012-05-24 15:40:16 +02:00 committed by Qt by Nokia
parent 60fb770fa7
commit 5131aefc1f
2 changed files with 2 additions and 3 deletions

View File

@ -6177,8 +6177,7 @@ static void drawTextItemDecoration(QPainter *painter, const QPointF &pos, const
const qreal underlineOffset = fe->underlinePosition().toReal();
// deliberately ceil the offset to avoid the underline coming too close to
// the text above it.
const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
const qreal underlinePos = pos.y() + qCeil(underlineOffset) - aliasedCoordinateDelta;
const qreal underlinePos = pos.y() + qCeil(underlineOffset);
if (underlineStyle == QTextCharFormat::SpellCheckUnderline) {
underlineStyle = QTextCharFormat::SpellCheckUnderline; // ### Qt5 QTextCharFormat::UnderlineStyle(QApplication::style()->styleHint(QStyle::SH_SpellCheckUnderlineStyle));

View File

@ -3046,7 +3046,7 @@ void QTextEngine::adjustUnderlines(ItemDecorationList::iterator start,
{
for (ItemDecorationList::iterator it = start; it != end; ++it) {
it->y = underlinePos;
it->pen.setWidth(penWidth);
it->pen.setWidthF(penWidth);
}
}