aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/scenegraph/twotextureproviders/xorblender.cpp')
-rw-r--r--examples/quick/scenegraph/twotextureproviders/xorblender.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
index 276625d908..9971f202a7 100644
--- a/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
+++ b/examples/quick/scenegraph/twotextureproviders/xorblender.cpp
@@ -117,13 +117,12 @@ int XorBlendMaterial::compare(const QSGMaterial *o) const
if (!state.texture2 || !other->state.texture2)
return state.texture2 ? -1 : 1;
- if (qint64 diff = state.texture1->comparisonKey() - other->state.texture1->comparisonKey())
- return diff;
+ qint64 diff = state.texture1->comparisonKey() - other->state.texture1->comparisonKey();
+ if (diff != 0)
+ return diff < 0 ? -1 : 1;
- if (qint64 diff = state.texture2->comparisonKey() - other->state.texture2->comparisonKey())
- return diff;
-
- return 0;
+ diff = state.texture2->comparisonKey() - other->state.texture2->comparisonKey();
+ return diff < 0 ? -1 : (diff > 0 ? 1 : 0);
}
XorBlendRhiShader::XorBlendRhiShader()