diff options
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 38 |
1 files changed, 3 insertions, 35 deletions
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index f34b4bb9a2..781888dd5b 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -271,35 +271,6 @@ static void qt_debug_path(const QPainterPath &path) } #endif -// QRect::normalized() will change the width/height of the rectangle due to -// its incusive-integer definition of left/right vs width. This is not -// something we want to change in QRect as that would potentially introduce -// regressions all over the place, so we implement a straightforward -// normalized here. QRectF already does this, so QRectF::normalized() is ok to -// use. -static QRect qrect_normalized(const QRect &rect) -{ - int x, y, w, h; - if (Q_UNLIKELY(rect.width() < 0)) { - x = rect.x() + rect.width(); - w = -rect.width(); - } else { - x = rect.x(); - w = rect.width(); - } - - if (Q_UNLIKELY(rect.height() < 0)) { - y = rect.y() + rect.height(); - h = -rect.height(); - } else { - y = rect.y(); - h = rect.height(); - } - - return QRect(x, y, w, h); -} - - QRasterPaintEnginePrivate::QRasterPaintEnginePrivate() : QPaintEngineExPrivate(), cachedLines(0) @@ -1320,9 +1291,7 @@ void QRasterPaintEngine::clip(const QRect &rect, Qt::ClipOperation op) bool QRasterPaintEngine::setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op) { Q_D(QRasterPaintEngine); - // normalize before using the & operator which uses QRect::normalize() - // internally which will give us the wrong values. - QRect clipRect = qrect_normalized(r) & d->deviceRect; + QRect clipRect = r & d->deviceRect; QRasterPaintEngineState *s = state(); if (op == Qt::ReplaceClip || s->clip == nullptr) { @@ -1557,7 +1526,7 @@ void QRasterPaintEngine::drawRects(const QRect *rects, int rectCount) int offset_x = int(s->matrix.dx()); int offset_y = int(s->matrix.dy()); while (r < lastRect) { - QRect rect = qrect_normalized(*r); + QRect rect = r->normalized(); QRect rr = rect.translated(offset_x, offset_y); fillRect_normalized(rr, &s->brushData, d); ++r; @@ -3006,8 +2975,8 @@ bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect, Q_Q(const QRasterPaintEngine); const QRasterPaintEngineState *s = q->state(); const QClipData *cl = clip(); + QRect r = rect.normalized(); if (!cl) { - QRect r = qrect_normalized(rect); // inline contains() for performance (we know the rects are normalized) const QRect &r1 = deviceRect; return (r.left() >= r1.left() && r.right() <= r1.right() @@ -3022,7 +2991,6 @@ bool QRasterPaintEnginePrivate::isUnclipped(const QRect &rect, if (s->flags.antialiased) ++penWidth; - QRect r = qrect_normalized(rect); if (penWidth > 0) { r.setX(r.x() - penWidth); r.setY(r.y() - penWidth); |