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/qpaintdevice.qdoc | 18 | ||||
-rw-r--r-- | src/gui/painting/qpathclipper.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qregion.cpp | 21 |
5 files changed, 40 insertions, 27 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/qpaintdevice.qdoc b/src/gui/painting/qpaintdevice.qdoc index 6c0b04c..ac1c3de 100644 --- a/src/gui/painting/qpaintdevice.qdoc +++ b/src/gui/painting/qpaintdevice.qdoc @@ -83,7 +83,7 @@ inch. The physicalDpiX() and physicalDpiY() functions also return the resolution of the device in dots per inch, but note that if the logical and vertical resolution differ, the corresponding - QPaintEngine must handle the mapping. Finally, the numColors() + QPaintEngine must handle the mapping. Finally, the colorCount() function returns the number of different colors available for the paint device. @@ -111,7 +111,7 @@ also heightMM(). \value PdmNumColors The number of different colors available for - the paint device. See also numColors(). + the paint device. See also colorCount(). \value PdmDepth The bit depth (number of bit planes) of the paint device. See also depth(). @@ -226,18 +226,18 @@ Use colorCount() instead. Returns the number of different colors available for the paint - device. Since this value is an int, it will not be sufficient to represent - the number of colors on 32 bit displays, in this case INT_MAX is - returned instead. -*/ + device. Since this value is an int, it will not be sufficient to + represent the number of colors on 32 bit displays, in this case + INT_MAX is returned instead. + */ /*! \fn int QPaintDevice::colorCount() const Returns the number of different colors available for the paint - device. Since this value is an int, it will not be sufficient to represent - the number of colors on 32 bit displays, in this case INT_MAX is - returned instead. + device. Since this value is an int, it will not be sufficient to + represent the number of colors on 32 bit displays, in this case + INT_MAX is returned instead. */ /*! 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; |