summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-08-29 08:13:40 +0200
committerLiang Qi <liang.qi@qt.io>2016-08-29 08:13:40 +0200
commitcc74452d6d259d36ac47c536f11a5efb269e8e44 (patch)
treee43ac89e9edde354d12fbddffcbb6e40108cc643 /src/gui
parent6cbd982836266a59e926d8f149ad0013bd8162a3 (diff)
parente52fcb7dc78c83586c813f55f087a98bae4eaa0e (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: configure src/plugins/platforms/winrt/qwinrtclipboard.cpp Change-Id: Ic6d58be3d1ed2bb507f2ba06c82361afd9f9ddb9
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qoffscreensurface.cpp2
-rw-r--r--src/gui/painting/qdrawhelper.cpp12
-rw-r--r--src/gui/painting/qdrawhelper_p.h1
-rw-r--r--src/gui/text/qtextdocument.cpp2
4 files changed, 9 insertions, 8 deletions
diff --git a/src/gui/kernel/qoffscreensurface.cpp b/src/gui/kernel/qoffscreensurface.cpp
index 41f7251277..a9535a6ad7 100644
--- a/src/gui/kernel/qoffscreensurface.cpp
+++ b/src/gui/kernel/qoffscreensurface.cpp
@@ -183,7 +183,7 @@ void QOffscreenSurface::create()
if (QThread::currentThread() != qGuiApp->thread())
qWarning("Attempting to create QWindow-based QOffscreenSurface outside the gui thread. Expect failures.");
d->offscreenWindow = new QWindow(d->screen);
- d->offscreenWindow->setObjectName("QOffscreenSurface");
+ d->offscreenWindow->setObjectName(QLatin1String("QOffscreenSurface"));
// Remove this window from the global list since we do not want it to be destroyed when closing the app.
// The QOffscreenSurface has to be usable even after exiting the event loop.
QGuiApplicationPrivate::window_list.removeOne(d->offscreenWindow);
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 8729640a80..30d3dee473 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5753,9 +5753,9 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int
dg = gamma[dg];
db = gamma[db];
- int nr = qt_div_255((sr - dr) * mr) + dr;
- int ng = qt_div_255((sg - dg) * mg) + dg;
- int nb = qt_div_255((sb - db) * mb) + db;
+ int nr = qt_div_255(sr * mr + dr * (255 - mr));
+ int ng = qt_div_255(sg * mg + dg * (255 - mg));
+ int nb = qt_div_255(sb * mb + db * (255 - mb));
nr = invgamma[nr];
ng = invgamma[ng];
@@ -5780,9 +5780,9 @@ static inline void grayBlendPixel(quint32 *dst, int coverage, int sr, int sg, in
int alpha = coverage;
int ialpha = 255 - alpha;
- int nr = (sr * alpha + ialpha * dr) / 255;
- int ng = (sg * alpha + ialpha * dg) / 255;
- int nb = (sb * alpha + ialpha * db) / 255;
+ int nr = qt_div_255(sr * alpha + dr * ialpha);
+ int ng = qt_div_255(sg * alpha + dg * ialpha);
+ int nb = qt_div_255(sb * alpha + db * ialpha);
nr = invgamma[nr];
ng = invgamma[ng];
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 21af6039f8..fa3e6396ec 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -760,6 +760,7 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) {
return t;
}
+// qt_div_255 is a fast rounded division by 255 using an approximation that is accurate for all positive 16-bit integers
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; }
static Q_DECL_CONSTEXPR Q_ALWAYS_INLINE uint qt_div_65535(uint x) { return (x + (x>>16) + 0x8000U) >> 16; }
diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp
index 723918ae69..bb44c19557 100644
--- a/src/gui/text/qtextdocument.cpp
+++ b/src/gui/text/qtextdocument.cpp
@@ -1315,7 +1315,7 @@ QTextCursor QTextDocument::find(const QString &subString, int from, FindFlags op
//do not include the character given in the position.
if (options & FindBackward) {
--pos ;
- if (pos < subString.size())
+ if (pos < 0)
return QTextCursor();
}