Fix clipped glyphs in text rendering of QGraphicsTextItem
[ChangeLog][QtGui] Clipping of visible glyphs when doing partial updates of a graphics view was off by 1. Also fixed an issue that caused rounding errors when transforming the clip rect into the glyphs draw space which was caused by transforming a QRect instead of a QRectF. Fixes: QTBUG-93432 Pick-to: 5.15 6.2 6.3 Change-Id: Ibdb0e4116872af0f88bf03d9b3ac95331058b882 Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
parent
fd3341a74e
commit
724e4646e2
@ -3045,10 +3045,10 @@ QRasterPaintEnginePrivate::getPenFunc(const QRectF &rect,
|
||||
static QPair<int, int> visibleGlyphRange(const QRectF &clip, QFontEngine *fontEngine,
|
||||
glyph_t *glyphs, QFixedPoint *positions, int numGlyphs)
|
||||
{
|
||||
QFixed clipLeft = QFixed::fromReal(clip.left());
|
||||
QFixed clipRight = QFixed::fromReal(clip.right());
|
||||
QFixed clipTop = QFixed::fromReal(clip.top());
|
||||
QFixed clipBottom = QFixed::fromReal(clip.bottom());
|
||||
QFixed clipLeft = QFixed::fromReal(clip.left() - 1);
|
||||
QFixed clipRight = QFixed::fromReal(clip.right() + 1);
|
||||
QFixed clipTop = QFixed::fromReal(clip.top() - 1);
|
||||
QFixed clipBottom = QFixed::fromReal(clip.bottom() + 1);
|
||||
|
||||
int first = 0;
|
||||
while (first < numGlyphs) {
|
||||
@ -3531,7 +3531,7 @@ QRasterPaintEngine::ClipType QRasterPaintEngine::clipType() const
|
||||
\internal
|
||||
Returns the bounding rect of the currently set clip.
|
||||
*/
|
||||
QRect QRasterPaintEngine::clipBoundingRect() const
|
||||
QRectF QRasterPaintEngine::clipBoundingRect() const
|
||||
{
|
||||
Q_D(const QRasterPaintEngine);
|
||||
|
||||
@ -3543,7 +3543,7 @@ QRect QRasterPaintEngine::clipBoundingRect() const
|
||||
if (clip->hasRectClip)
|
||||
return clip->clipRect;
|
||||
|
||||
return QRect(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin);
|
||||
return QRectF(clip->xmin, clip->ymin, clip->xmax - clip->xmin, clip->ymax - clip->ymin);
|
||||
}
|
||||
|
||||
void QRasterPaintEnginePrivate::initializeRasterizer(QSpanData *data)
|
||||
|
@ -204,7 +204,7 @@ public:
|
||||
ComplexClip
|
||||
};
|
||||
ClipType clipType() const;
|
||||
QRect clipBoundingRect() const;
|
||||
QRectF clipBoundingRect() const;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
void setDC(HDC hdc);
|
||||
|
Loading…
x
Reference in New Issue
Block a user