diff options
author | Liang Qi <liang.qi@qt.io> | 2018-03-28 12:30:12 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2018-03-28 12:30:12 +0000 |
commit | 40011193f42a591c1fe5b1029764895eeed71b1f (patch) | |
tree | 22e23d80f30cd310832ad71334a445df92358ed1 /src/gui | |
parent | 48cca518dfa1feff03572550068c9a50a5051830 (diff) | |
parent | 794781e7cff9f7d44af64292796428478ed18663 (diff) |
Merge "Merge remote-tracking branch 'origin/5.11' into dev" into refs/staging/dev
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/painting/qblendfunctions_p.h | 20 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_sse2.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 7 |
4 files changed, 35 insertions, 7 deletions
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h index 167f725143..dc7a4dfe8c 100644 --- a/src/gui/painting/qblendfunctions_p.h +++ b/src/gui/painting/qblendfunctions_p.h @@ -137,6 +137,16 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl, // this bounds check here is required as floating point rounding above might in some cases lead to // w/h values that are one pixel too large, falling outside of the valid image area. + const int ystart = srcy >> 16; + if (ystart >= srch && iy < 0) { + srcy += iy; + --h; + } + const int xstart = basex >> 16; + if (xstart >= (int)(sbpl/sizeof(SRC)) && ix < 0) { + basex += ix; + --w; + } int yend = (srcy + iy * (h - 1)) >> 16; if (yend < 0 || yend >= srch) --h; @@ -248,6 +258,16 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl, // this bounds check here is required as floating point rounding above might in some cases lead to // w/h values that are one pixel too large, falling outside of the valid image area. + const int ystart = srcy >> 16; + if (ystart >= srch && iy < 0) { + srcy += iy; + --h; + } + const int xstart = basex >> 16; + if (xstart >= (int)(sbpl/sizeof(quint32)) && ix < 0) { + basex += ix; + --w; + } int yend = (srcy + iy * (h - 1)) >> 16; if (yend < 0 || yend >= srch) --h; diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp index bfe2080298..3212ffdd2d 100644 --- a/src/gui/painting/qdrawhelper_sse2.cpp +++ b/src/gui/painting/qdrawhelper_sse2.cpp @@ -558,6 +558,16 @@ void qt_scale_image_argb32_on_argb32_sse2(uchar *destPixels, int dbpl, // this bounds check here is required as floating point rounding above might in some cases lead to // w/h values that are one pixel too large, falling outside of the valid image area. + const int ystart = srcy >> 16; + if (ystart >= srch && iy < 0) { + srcy += iy; + --h; + } + const int xstart = basex >> 16; + if (xstart >= (int)(sbpl/sizeof(quint32)) && ix < 0) { + basex += ix; + --w; + } int yend = (srcy + iy * (h - 1)) >> 16; if (yend < 0 || yend >= srch) --h; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 33fde8c61a..6336b2943e 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -698,6 +698,11 @@ void QRasterPaintEngine::setState(QPainterState *s) { Q_D(QRasterPaintEngine); QPaintEngineEx::setState(s); + QRasterPaintEngineState *t = state(); + if (t->clip && t->clip->enabled != t->clipEnabled) { + // Since we do not "detach" clipdata when changing only enabled state, we need to resync state here + t->clip->enabled = t->clipEnabled; + } d->rasterBuffer->compositionMode = s->composition_mode; } diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 27bd2e59e6..2574a00838 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1033,7 +1033,6 @@ void QPainterPath::addRect(const QRectF &r) bool first = d_func()->elements.size() < 2; - d_func()->elements.reserve(d_func()->elements.size() + 5); moveTo(r.x(), r.y()); Element l1 = { r.x() + r.width(), r.y(), LineToElement }; @@ -1071,8 +1070,6 @@ void QPainterPath::addPolygon(const QPolygonF &polygon) ensureData(); detach(); - d_func()->elements.reserve(d_func()->elements.size() + polygon.size()); - moveTo(polygon.constFirst()); for (int i=1; i<polygon.size(); ++i) { Element elm = { polygon.at(i).x(), polygon.at(i).y(), LineToElement }; @@ -1115,9 +1112,7 @@ void QPainterPath::addEllipse(const QRectF &boundingRect) ensureData(); detach(); - Q_D(QPainterPath); bool first = d_func()->elements.size() < 2; - d->elements.reserve(d->elements.size() + 13); QPointF pts[12]; int point_count; @@ -1294,7 +1289,6 @@ void QPainterPath::addRegion(const QRegion ®ion) ensureData(); detach(); - d_func()->elements.reserve(region.rectCount() * 5); for (const QRect &rect : region) addRect(rect); } @@ -2463,7 +2457,6 @@ QDataStream &operator>>(QDataStream &s, QPainterPath &p) Q_ASSERT(p.d_func()->elements.at(0).type == QPainterPath::MoveToElement); p.d_func()->elements.clear(); } - p.d_func()->elements.reserve(p.d_func()->elements.size() + size); for (int i=0; i<size; ++i) { int type; double x, y; |