summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/angle/src/config.pri5
-rw-r--r--src/gui/painting/qblendfunctions_p.h119
-rw-r--r--src/testlib/qbenchmarkvalgrind.cpp18
3 files changed, 41 insertions, 101 deletions
diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri
index 5c521281a6..cafae0e742 100644
--- a/src/angle/src/config.pri
+++ b/src/angle/src/config.pri
@@ -79,10 +79,9 @@ msvc {
# /Oy: Omits frame pointer (x86 only).
# /Gy: Enables function-level linking.
# /GS: Buffers security check.
- # /Gm-: Disable minimal rebuild.
# /RTC1: Run time error checking
- QMAKE_CFLAGS_RELEASE += -Oy- -Gy -GS -Gm-
- QMAKE_CFLAGS_DEBUG += -Oy- -Gy -GS -Gm- -RTC1
+ QMAKE_CFLAGS_RELEASE += -Oy- -Gy -GS
+ QMAKE_CFLAGS_DEBUG += -Oy- -Gy -GS -RTC1
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -Zi $$QMAKE_CFLAGS_RELEASE
QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON
diff --git a/src/gui/painting/qblendfunctions_p.h b/src/gui/painting/qblendfunctions_p.h
index dc7a4dfe8c..5ea78cdde2 100644
--- a/src/gui/painting/qblendfunctions_p.h
+++ b/src/gui/painting/qblendfunctions_p.h
@@ -65,11 +65,11 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
const QRect &clip,
T blender)
{
- qreal sx = targetRect.width() / (qreal) srcRect.width();
- qreal sy = targetRect.height() / (qreal) srcRect.height();
+ qreal sx = srcRect.width() / (qreal) targetRect.width();
+ qreal sy = srcRect.height() / (qreal) targetRect.height();
- int ix = 0x00010000 / sx;
- int iy = 0x00010000 / sy;
+ const int ix = 0x00010000 * sx;
+ const int iy = 0x00010000 * sy;
// qDebug() << "scale:" << endl
// << " - target" << targetRect << endl
@@ -77,59 +77,30 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
// << " - clip" << clip << endl
// << " - sx=" << sx << " sy=" << sy << " ix=" << ix << " iy=" << iy;
- int cx1 = clip.x();
- int cx2 = clip.x() + clip.width();
- int cy1 = clip.top();
- int cy2 = clip.y() + clip.height();
-
- int tx1 = qRound(targetRect.left());
- int tx2 = qRound(targetRect.right());
- int ty1 = qRound(targetRect.top());
- int ty2 = qRound(targetRect.bottom());
-
- if (tx2 < tx1)
- qSwap(tx2, tx1);
-
- if (ty2 < ty1)
- qSwap(ty2, ty1);
-
- if (tx1 < cx1)
- tx1 = cx1;
-
- if (tx2 >= cx2)
- tx2 = cx2;
-
- if (tx1 >= tx2)
+ QRect tr = targetRect.normalized().toRect();
+ tr = tr.intersected(clip);
+ if (tr.isEmpty())
return;
-
- if (ty1 < cy1)
- ty1 = cy1;
-
- if (ty2 >= cy2)
- ty2 = cy2;
-
- if (ty1 >= ty2)
- return;
-
- int h = ty2 - ty1;
- int w = tx2 - tx1;
-
+ const int tx1 = tr.left();
+ const int ty1 = tr.top();
+ int h = tr.height();
+ int w = tr.width();
quint32 basex;
quint32 srcy;
if (sx < 0) {
- int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
+ int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * sx * 65536) + 1;
basex = quint32(srcRect.right() * 65536) + dstx;
} else {
- int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
+ int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * sx * 65536) - 1;
basex = quint32(srcRect.left() * 65536) + dstx;
}
if (sy < 0) {
- int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
+ int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * sy * 65536) + 1;
srcy = quint32(srcRect.bottom() * 65536) + dsty;
} else {
- int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
+ int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * sy * 65536) - 1;
srcy = quint32(srcRect.top() * 65536) + dsty;
}
@@ -185,11 +156,11 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
const QRect &clip,
T blender)
{
- qreal sx = targetRect.width() / (qreal) srcRect.width();
- qreal sy = targetRect.height() / (qreal) srcRect.height();
+ qreal sx = srcRect.width() / (qreal) targetRect.width();
+ qreal sy = srcRect.height() / (qreal) targetRect.height();
- int ix = 0x00010000 / sx;
- int iy = 0x00010000 / sy;
+ const int ix = 0x00010000 * sx;
+ const int iy = 0x00010000 * sy;
// qDebug() << "scale:" << endl
// << " - target" << targetRect << endl
@@ -197,60 +168,30 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
// << " - clip" << clip << endl
// << " - sx=" << sx << " sy=" << sy << " ix=" << ix << " iy=" << iy;
- int cx1 = clip.x();
- int cx2 = clip.x() + clip.width();
- int cy1 = clip.top();
- int cy2 = clip.y() + clip.height();
-
- int tx1 = qRound(targetRect.left());
- int tx2 = qRound(targetRect.right());
- int ty1 = qRound(targetRect.top());
- int ty2 = qRound(targetRect.bottom());
-
- if (tx2 < tx1)
- qSwap(tx2, tx1);
-
- if (ty2 < ty1)
- qSwap(ty2, ty1);
-
- if (tx1 < cx1)
- tx1 = cx1;
-
- if (tx2 >= cx2)
- tx2 = cx2;
-
- if (tx1 >= tx2)
- return;
-
- if (ty1 < cy1)
- ty1 = cy1;
-
- if (ty2 >= cy2)
- ty2 = cy2;
-
- if (ty1 >= ty2)
- return;
-
- int h = ty2 - ty1;
- int w = tx2 - tx1;
- if (!w || !h)
+ QRect tr = targetRect.normalized().toRect();
+ tr = tr.intersected(clip);
+ if (tr.isEmpty())
return;
+ const int tx1 = tr.left();
+ const int ty1 = tr.top();
+ int h = tr.height();
+ int w = tr.width();
quint32 basex;
quint32 srcy;
if (sx < 0) {
- int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
+ int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * sx * 65536) + 1;
basex = quint32(srcRect.right() * 65536) + dstx;
} else {
- int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * ix) - 1;
+ int dstx = qCeil((tx1 + qreal(0.5) - targetRect.left()) * sx * 65536) - 1;
basex = quint32(srcRect.left() * 65536) + dstx;
}
if (sy < 0) {
- int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * iy) + 1;
+ int dsty = qFloor((ty1 + qreal(0.5) - targetRect.bottom()) * sy * 65536) + 1;
srcy = quint32(srcRect.bottom() * 65536) + dsty;
} else {
- int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * iy) - 1;
+ int dsty = qCeil((ty1 + qreal(0.5) - targetRect.top()) * sy * 65536) - 1;
srcy = quint32(srcRect.top() * 65536) + dsty;
}
diff --git a/src/testlib/qbenchmarkvalgrind.cpp b/src/testlib/qbenchmarkvalgrind.cpp
index 1de149258d..7d24eb8293 100644
--- a/src/testlib/qbenchmarkvalgrind.cpp
+++ b/src/testlib/qbenchmarkvalgrind.cpp
@@ -46,6 +46,7 @@
#include <QtCore/qcoreapplication.h>
#include <QtCore/qprocess.h>
#include <QtCore/qdir.h>
+#include <QtCore/qregularexpression.h>
#include <QtCore/qset.h>
#include <QtTest/private/callgrind_p.h>
@@ -90,13 +91,13 @@ qint64 QBenchmarkValgrindUtils::extractResult(const QString &fileName)
qint64 val = -1;
bool valSeen = false;
- QRegExp rxValue(QLatin1String("^summary: (\\d+)"));
+ QRegularExpression rxValue(QLatin1String("^summary: (\\d+)"));
while (!file.atEnd()) {
const QString line(QLatin1String(file.readLine()));
- if (rxValue.indexIn(line) != -1) {
- Q_ASSERT(rxValue.captureCount() == 1);
+ QRegularExpressionMatch match = rxValue.match(line);
+ if (match.hasMatch()) {
bool ok;
- val = rxValue.cap(1).toLongLong(&ok);
+ val = match.captured(1).toLongLong(&ok);
Q_ASSERT(ok);
valSeen = true;
break;
@@ -120,13 +121,12 @@ QString QBenchmarkValgrindUtils::getNewestFileName()
int hiSuffix = -1;
QFileInfo lastFileInfo;
const QString pattern = QString::fromLatin1("%1.(\\d+)").arg(base);
- QRegExp rx(pattern);
+ QRegularExpression rx(pattern);
for (const QFileInfo &fileInfo : fiList) {
- const int index = rx.indexIn(fileInfo.fileName());
- Q_ASSERT(index == 0);
- Q_UNUSED(index);
+ QRegularExpressionMatch match = rx.match(fileInfo.fileName());
+ Q_ASSERT(match.hasMatch());
bool ok;
- const int suffix = rx.cap(1).toInt(&ok);
+ const int suffix = match.captured(1).toInt(&ok);
Q_ASSERT(ok);
Q_ASSERT(suffix >= 0);
if (suffix > hiSuffix) {