diff options
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qblendfunctions.cpp | 24 | ||||
-rw-r--r-- | src/gui/painting/qpaintbuffer_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qpathclipper.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qregion.cpp | 21 |
4 files changed, 31 insertions, 18 deletions
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index 8737f10..ba1b642 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -223,21 +223,25 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, int h = ty2 - ty1; int w = tx2 - tx1; + quint32 basex; quint32 srcy; + const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1; + const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1; + if (sx < 0) { - int dstx = qFloor((tx1 + 0.5 - targetRect.right()) * ix) + 1; + int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1; basex = quint32(srcRect.right() * 65536) + dstx; } else { - int dstx = qCeil((tx1 + 0.5 - targetRect.left()) * ix) - 1; + int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1; basex = quint32(srcRect.left() * 65536) + dstx; } if (sy < 0) { - int dsty = qFloor((ty1 + 0.5 - targetRect.bottom()) * iy) + 1; + int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1; srcy = quint32(srcRect.bottom() * 65536) + dsty; } else { - int dsty = qCeil((ty1 + 0.5 - targetRect.top()) * iy) - 1; + int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1; srcy = quint32(srcRect.top() * 65536) + dsty; } @@ -738,18 +742,22 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, quint32 basex; quint32 srcy; + const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1; + const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1; + + if (sx < 0) { - int dstx = qFloor((tx1 + 0.5 - targetRect.right()) * ix) + 1; + int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1; basex = quint32(srcRect.right() * 65536) + dstx; } else { - int dstx = qCeil((tx1 + 0.5 - targetRect.left()) * ix) - 1; + int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1; basex = quint32(srcRect.left() * 65536) + dstx; } if (sy < 0) { - int dsty = qFloor((ty1 + 0.5 - targetRect.bottom()) * iy) + 1; + int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1; srcy = quint32(srcRect.bottom() * 65536) + dsty; } else { - int dsty = qCeil((ty1 + 0.5 - targetRect.top()) * iy) - 1; + int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1; srcy = quint32(srcRect.top() * 65536) + dsty; } diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h index adf0564..e100512 100644 --- a/src/gui/painting/qpaintbuffer_p.h +++ b/src/gui/painting/qpaintbuffer_p.h @@ -66,7 +66,7 @@ class QPaintBufferPlayback; class Q_GUI_EXPORT QPaintBuffer : public QPaintDevice { - Q_DECLARE_PRIVATE(QPaintBuffer); + Q_DECLARE_PRIVATE(QPaintBuffer) public: QPaintBuffer(); QPaintBuffer(const QPaintBuffer &other); diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index ab2dc33..51d6195 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -1650,7 +1650,7 @@ static void clear(QWingedEdge& list, int edge, QPathEdge::Traversal traversal) template <typename InputIterator> InputIterator qFuzzyFind(InputIterator first, InputIterator last, qreal val) { - while (first != last && !qFuzzyCompare(qreal(*first), qreal(val))) + while (first != last && !QT_PREPEND_NAMESPACE(qFuzzyCompare)(qreal(*first), qreal(val))) ++first; return first; } diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 9d1d965..63dec2b 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3867,23 +3867,28 @@ QRegion::QRegion(const QRect &r, RegionType t) QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule) { if (a.count() > 2) { - d = new QRegionData; - d->ref = 1; + QRegionPrivate *qt_rgn = PolygonRegion(a.constData(), a.size(), + fillRule == Qt::WindingFill ? WindingRule : EvenOddRule); + if (qt_rgn) { + d = new QRegionData; + d->ref = 1; #if defined(Q_WS_X11) - d->rgn = 0; - d->xrectangles = 0; + d->rgn = 0; + d->xrectangles = 0; #elif defined(Q_WS_WIN) - d->rgn = 0; + d->rgn = 0; #endif - d->qt_rgn = PolygonRegion(a.constData(), a.size(), - fillRule == Qt::WindingFill ? WindingRule : EvenOddRule); + d->qt_rgn = qt_rgn; + } else { + d = &shared_empty; + d->ref.ref(); + } } else { d = &shared_empty; d->ref.ref(); } } - QRegion::QRegion(const QRegion &r) { d = r.d; |