aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgrhishadereffectnode.cpp
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-27 13:36:01 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-05-27 15:39:30 +0200
commit756c4c9e6d51564bc32c99701efd939303ce31ff (patch)
tree25e8f4d6e6cd52e636d69777ec8d75acc32e3d9e /src/quick/scenegraph/qsgrhishadereffectnode.cpp
parent201f28c7e332bc0cb37a80f4ffff0d473d24455a (diff)
Avoid truncating in QSGMaterial::compare() implementations
The Qt 5.0 pattern of subtracting pointers and returning them is not suitable (on 64-bit archs) since the return type is an int. There is also QSGTexture::comparisonKey() now which is a qint64. Just return -1 and 1 as appropriate. Change-Id: Iaf3377b484a8c4b19b0960f1e8def05e4fa68ce7 Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/quick/scenegraph/qsgrhishadereffectnode.cpp')
-rw-r--r--src/quick/scenegraph/qsgrhishadereffectnode.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/quick/scenegraph/qsgrhishadereffectnode.cpp b/src/quick/scenegraph/qsgrhishadereffectnode.cpp
index 2afb40a61e..f4477918c0 100644
--- a/src/quick/scenegraph/qsgrhishadereffectnode.cpp
+++ b/src/quick/scenegraph/qsgrhishadereffectnode.cpp
@@ -494,8 +494,9 @@ int QSGRhiShaderEffectMaterial::compare(const QSGMaterial *other) const
QSGTexture *t1 = tp1->texture();
QSGTexture *t2 = tp2->texture();
if (t1 && t2) {
- if (qint64 diff = t1->comparisonKey() - t2->comparisonKey())
- return diff;
+ const qint64 diff = t1->comparisonKey() - t2->comparisonKey();
+ if (diff != 0)
+ return diff < 0 ? -1 : 1;
} else {
if (!t1 && t2)
return -1;