summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-04-23 15:09:35 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-04-24 18:16:54 +0000
commite413874467c01cff63bb53e630d1e5d9d19fda53 (patch)
tree7987a42839cdc5112234de414b1a0521cbab789f /src/gui/painting
parent143cf9e4675ff0f1317dce915aef009886307cf8 (diff)
Fix division by zero in radial gradiants with NEON
The NEON implementation uses rsqrt and thus can not be taken on 0, so replace the minimum with something close to zero instead of zero. Task-number: QTBUG-59961 Change-Id: Ia39e45be675b056c1e22900495ce9ba4e8b70e5f Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qdrawhelper_p.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index b94fd34b51..6f3c92ca64 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -520,7 +520,12 @@ public:
const typename Simd::Float32x4 v_r0 = Simd::v_dup(data->gradient.radial.focal.radius);
const typename Simd::Float32x4 v_dr = Simd::v_dup(op->radial.dr);
+#if defined(__ARM_NEON__)
+ // NEON doesn't have SIMD sqrt, but uses rsqrt instead that can't be taken of 0.
+ const typename Simd::Float32x4 v_min = Simd::v_dup(std::numeric_limits<float>::epsilon());
+#else
const typename Simd::Float32x4 v_min = Simd::v_dup(0.0f);
+#endif
const typename Simd::Float32x4 v_max = Simd::v_dup(float(GRADIENT_STOPTABLE_SIZE-1));
const typename Simd::Float32x4 v_half = Simd::v_dup(0.5f);