summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-05-30 15:22:30 +0000
committerThe Qt Project <gerrit-noreply@qt-project.org>2017-05-30 15:22:30 +0000
commit4f9c53d351cb68e857a5a839918964934a70e6e2 (patch)
tree3067191cf96c9bd369cda75b7bff34600ff712a6 /src/gui
parentdc72ff7b978a935d95bced05d8b2c8eee87d042d (diff)
parent6a772fd201ac738dc86e71bd82e98f65158e6335 (diff)
Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/configure.json13
-rw-r--r--src/gui/kernel/qguiapplication.cpp13
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp3
-rw-r--r--src/gui/painting/qdrawhelper.cpp66
-rw-r--r--src/gui/painting/qpainterpath.cpp33
-rw-r--r--src/gui/text/qtextlayout.cpp6
6 files changed, 96 insertions, 38 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 672128a789..d074bf6794 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -9,6 +9,7 @@
"options": {
"accessibility": "boolean",
"angle": "boolean",
+ "combined-angle-lib": "boolean",
"direct2d": "boolean",
"directfb": "boolean",
"directwrite": "boolean",
@@ -443,6 +444,13 @@
{ "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" }
]
},
+ "combined-angle-lib": {
+ "label": "Combined ANGLE Library",
+ "autoDetect": false,
+ "enable": "features.angle",
+ "condition": "features.angle",
+ "output": [ "publicFeature" ]
+ },
"directfb": {
"label": "DirectFB",
"section": "Platform plugins",
@@ -1111,6 +1119,11 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"args": "angle",
"condition": "config.win32"
},
+ {
+ "type": "feature",
+ "args": "combined-angle-lib",
+ "condition": "features.angle"
+ },
"opengl-desktop",
{
"type": "feature",
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 808f3ad166..7e62ebf161 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -641,6 +641,18 @@ QGuiApplication::~QGuiApplication()
QGuiApplicationPrivate::m_inputDeviceManager = 0;
delete QGuiApplicationPrivate::desktopFileName;
QGuiApplicationPrivate::desktopFileName = 0;
+ QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
+ QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
+ QGuiApplicationPrivate::lastCursorPosition = {qInf(), qInf()};
+ QGuiApplicationPrivate::currentMousePressWindow = QGuiApplicationPrivate::currentMouseWindow = nullptr;
+ QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive;
+ QGuiApplicationPrivate::highDpiScalingUpdated = false;
+ QGuiApplicationPrivate::tabletDevicePoints.clear();
+#ifndef QT_NO_SESSIONMANAGER
+ QGuiApplicationPrivate::is_fallback_session_management_enabled = true;
+#endif
+ QGuiApplicationPrivate::mousePressTime = 0;
+ QGuiApplicationPrivate::mousePressX = QGuiApplicationPrivate::mousePressY = 0;
}
QGuiApplicationPrivate::QGuiApplicationPrivate(int &argc, char **argv, int flags)
@@ -1538,6 +1550,7 @@ QGuiApplicationPrivate::~QGuiApplicationPrivate()
delete m_a32ColorProfile.load();
window_list.clear();
+ screen_list.clear();
}
#if 0
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 974391d3a4..f1f74e1342 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -215,7 +215,8 @@ bool QWindowSystemEventHandler::sendEvent(QWindowSystemInterfacePrivate::WindowS
QT_DEFINE_QPA_EVENT_HANDLER(void, handleEnterEvent, QWindow *window, const QPointF &local, const QPointF &global)
{
if (window) {
- QWindowSystemInterfacePrivate::EnterEvent *e = new QWindowSystemInterfacePrivate::EnterEvent(window, local, global);
+ QWindowSystemInterfacePrivate::EnterEvent *e
+ = new QWindowSystemInterfacePrivate::EnterEvent(window, QHighDpi::fromNativeLocalPosition(local, window), QHighDpi::fromNativePixels(global, window));
QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
}
}
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 82100166d2..dc630aa931 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -5643,17 +5643,11 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, QRgba64 slinear, co
static inline void grayBlendPixel(quint32 *dst, int coverage, QRgba64 srcLinear, const QColorProfile *colorProfile)
{
// Do a gammacorrected gray alphablend...
- QRgba64 dstLinear = QRgba64::fromArgb32(*dst);
+ const QRgba64 dstLinear = colorProfile ? colorProfile->toLinear64(*dst) : QRgba64::fromArgb32(*dst);
- if (colorProfile && !dstLinear.isTransparent())
- dstLinear = colorProfile->fromLinear(dstLinear.unpremultiplied()).premultiplied();
+ QRgba64 blend = interpolate255(srcLinear, coverage, dstLinear, 255 - coverage);
- dstLinear = interpolate255(srcLinear, coverage, dstLinear, 255 - coverage);
-
- if (colorProfile && !dstLinear.isTransparent())
- dstLinear = colorProfile->fromLinear(dstLinear.unpremultiplied()).premultiplied();
-
- *dst = toArgb32(dstLinear);
+ *dst = colorProfile ? colorProfile->fromLinear64(blend) : toArgb32(blend);
}
static inline void alphamapblend_argb32(quint32 *dst, int coverage, QRgba64 srcLinear, quint32 src, const QColorProfile *colorProfile)
@@ -5663,7 +5657,12 @@ static inline void alphamapblend_argb32(quint32 *dst, int coverage, QRgba64 srcL
} else if (coverage == 255) {
*dst = src;
} else {
- grayBlendPixel(dst, coverage, srcLinear, colorProfile);
+ if (*dst >= 0xff000000) {
+ grayBlendPixel(dst, coverage, srcLinear, colorProfile);
+ } else {
+ // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
+ *dst = INTERPOLATE_PIXEL_255(src, coverage, *dst, 255 - coverage);
+ }
}
}
@@ -5751,14 +5750,25 @@ static inline void alphargbblend_generic(uint coverage, QRgba64 *dest, int x, co
dstColor = colorProfile->fromLinear(dstColor);
dest[x] = dstColor;
} else {
- // Give up and do a gray alphablend.
- if (colorProfile && !dstColor.isTransparent())
- dstColor = colorProfile->toLinear(dstColor.unpremultiplied()).premultiplied();
+ // Do a gray alphablend.
+ alphamapblend_generic(qRgbAvg(coverage), dest, x, srcLinear, src, colorProfile);
+ }
+ }
+}
+
+static inline void alphargbblend_argb32(quint32 *dst, uint coverage, QRgba64 srcLinear, quint32 src, const QColorProfile *colorProfile)
+{
+ if (coverage == 0xff000000) {
+ // nothing
+ } else if (coverage == 0xffffffff) {
+ *dst = src;
+ } else {
+ if (*dst >= 0xff000000) {
+ rgbBlendPixel(dst, coverage, srcLinear, colorProfile);
+ } else {
+ // Give up and do a naive gray alphablend. Needed to deal with ARGB32 and invalid ARGB32_premultiplied, see QTBUG-60571
const int a = qRgbAvg(coverage);
- dstColor = interpolate255(srcLinear, coverage, dstColor, 255 - a);
- if (colorProfile && !dstColor.isTransparent())
- dstColor = colorProfile->fromLinear(dstColor.unpremultiplied()).premultiplied();
- dest[x] = dstColor;
+ *dst = INTERPOLATE_PIXEL_255(src, a, *dst, 255 - a);
}
}
}
@@ -5863,16 +5873,7 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
while (mapHeight--) {
for (int i = 0; i < mapWidth; ++i) {
const uint coverage = src[i];
- if (coverage == 0xffffffff) {
- dst[i] = c;
- } else if (coverage != 0xff000000) {
- if (dst[i] >= 0xff000000) {
- rgbBlendPixel(dst + i, coverage, srcColor, colorProfile);
- } else {
- // Give up and do a gray blend.
- grayBlendPixel(dst + i, qRgbAvg(coverage), srcColor, colorProfile);
- }
- }
+ alphargbblend_argb32(dst + i, coverage, srcColor, c, colorProfile);
}
dst += destStride;
@@ -5898,16 +5899,7 @@ static void qt_alphargbblit_argb32(QRasterBuffer *rasterBuffer,
for (int xp=start; xp<end; ++xp) {
const uint coverage = src[xp - x];
- if (coverage == 0xffffffff) {
- dst[xp] = c;
- } else if (coverage != 0xff000000) {
- if (dst[xp] >= 0xff000000) {
- rgbBlendPixel(dst + xp, coverage, srcColor, colorProfile);
- } else {
- // Give up and do a gray blend.
- grayBlendPixel(dst + xp, qRgbAvg(coverage), srcColor, colorProfile);
- }
- }
+ alphargbblend_argb32(dst + xp, coverage, srcColor, c, colorProfile);
}
} // for (i -> line.count)
src += srcStride;
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index 7dbc83b338..27bd2e59e6 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1981,6 +1981,17 @@ static bool qt_isect_curve_vertical(const QBezier &bezier, qreal x, qreal y1, qr
return false;
}
+static bool pointOnEdge(const QRectF &rect, const QPointF &point)
+{
+ if ((point.x() == rect.left() || point.x() == rect.right()) &&
+ (point.y() >= rect.top() && point.y() <= rect.bottom()))
+ return true;
+ if ((point.y() == rect.top() || point.y() == rect.bottom()) &&
+ (point.x() >= rect.left() && point.x() <= rect.right()))
+ return true;
+ return false;
+}
+
/*
Returns \c true if any lines or curves cross the four edges in of rect
*/
@@ -1988,6 +1999,7 @@ static bool qt_painterpath_check_crossing(const QPainterPath *path, const QRectF
{
QPointF last_pt;
QPointF last_start;
+ enum { OnRect, InsideRect, OutsideRect} edgeStatus = OnRect;
for (int i=0; i<path->elementCount(); ++i) {
const QPainterPath::Element &e = path->elementAt(i);
@@ -2026,6 +2038,27 @@ static bool qt_painterpath_check_crossing(const QPainterPath *path, const QRectF
default:
break;
}
+ // Handle crossing the edges of the rect at the end-points of individual sub-paths.
+ // A point on on the edge itself is considered neither inside nor outside for this purpose.
+ if (!pointOnEdge(rect, last_pt)) {
+ bool contained = rect.contains(last_pt);
+ switch (edgeStatus) {
+ case OutsideRect:
+ if (contained)
+ return true;
+ break;
+ case InsideRect:
+ if (!contained)
+ return true;
+ break;
+ case OnRect:
+ edgeStatus = contained ? InsideRect : OutsideRect;
+ break;
+ }
+ } else {
+ if (last_pt == last_start)
+ edgeStatus = OnRect;
+ }
}
// implicitly close last subpath
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp
index 2848d55fef..066f258ea3 100644
--- a/src/gui/text/qtextlayout.cpp
+++ b/src/gui/text/qtextlayout.cpp
@@ -630,6 +630,9 @@ Qt::CursorMoveStyle QTextLayout::cursorMoveStyle() const
/*!
Begins the layout process.
+ \warning This will invalidate the layout, so all existing QTextLine objects
+ that refer to the previous contents should now be discarded.
+
\sa endLayout()
*/
void QTextLayout::beginLayout()
@@ -673,6 +676,9 @@ void QTextLayout::endLayout()
Clears the line information in the layout. After having called
this function, lineCount() returns 0.
+
+ \warning This will invalidate the layout, so all existing QTextLine objects
+ that refer to the previous contents should now be discarded.
*/
void QTextLayout::clearLayout()
{