diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 54d337ecc5..66341e186a 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -44,6 +44,7 @@ #include <qthread.h> #include <qfont.h> +#include <qmath.h> #include <qpainter.h> #include <qvarlengtharray.h> #include <qtextformat.h> @@ -946,15 +947,23 @@ static void addSelectedRegionsToPath(QTextEngine *eng, int lineNumber, const QPo continue; } - if (lastSelectionWidth > 0) - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); + if (lastSelectionWidth > 0) { + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); + rect.moveLeft(qFloor(rect.left())); + rect.moveTop(qFloor(rect.top())); + region->addRect(rect); + } lastSelectionX = selectionX; lastSelectionWidth = selectionWidth; } } - if (lastSelectionWidth > 0) - region->addRect(boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight)); + if (lastSelectionWidth > 0) { + QRectF rect = boundingRect & QRectF(lastSelectionX.toReal(), selectionY, lastSelectionWidth.toReal(), lineHeight); + rect.moveLeft(qFloor(rect.left())); + rect.moveTop(qFloor(rect.top())); + region->addRect(rect); + } } static inline QRectF clipIfValid(const QRectF &rect, const QRectF &clip) @@ -2077,7 +2086,7 @@ static void setPenAndDrawBackground(QPainter *p, const QPen &defaultPen, const Q QBrush bg = chf.background(); if (bg.style() != Qt::NoBrush && !chf.property(SuppressBackground).toBool()) - p->fillRect(r, bg); + p->fillRect(QRectF(qFloor(r.x()), qFloor(r.y()), r.width(), r.height()), bg); if (c.style() != Qt::NoBrush) { p->setPen(QPen(c, 0)); } |