From 8029a015b4a11c48a262f0e9fc8b4a2674fbd505 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Thu, 28 Nov 2013 11:44:39 +0100 Subject: Handle boundingboxes with NaN in them. NaN does not compare well with other floats. The result is that the bounding box is left at its initial values, FLT_MAX for top-left and FLT_MIN for bottom-right. If so, treat geometry as invalid, aka infinite. Task-number: QTBUG-35192 Change-Id: I1df6987d56a0ce1f500b0eba344a5dcbc55f80a4 Reviewed-by: Mitch Curtis Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp | 11 +++++++---- src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h | 4 ---- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp index 79b5de72c0..676efe84bc 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp @@ -590,15 +590,18 @@ void Element::computeBounds() } bounds.map(*node->matrix()); - if (!qIsFinite(bounds.tl.x)) + if (!qIsFinite(bounds.tl.x) || bounds.tl.x == FLT_MAX) bounds.tl.x = -FLT_MAX; - if (!qIsFinite(bounds.tl.y)) + if (!qIsFinite(bounds.tl.y) || bounds.tl.y == FLT_MAX) bounds.tl.y = -FLT_MAX; - if (!qIsFinite(bounds.br.x)) + if (!qIsFinite(bounds.br.x) || bounds.br.x == -FLT_MAX) bounds.br.x = FLT_MAX; - if (!qIsFinite(bounds.br.y)) + if (!qIsFinite(bounds.br.y) || bounds.br.y == -FLT_MAX) bounds.br.y = FLT_MAX; + Q_ASSERT(bounds.tl.x <= bounds.br.x); + Q_ASSERT(bounds.tl.y <= bounds.br.y); + boundsOutsideFloatRange = bounds.isOutsideFloatRange(); } diff --git a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h index 95e111552d..5404b669a0 100644 --- a/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h +++ b/src/quick/scenegraph/coreapi/qsgbatchrenderer_p.h @@ -104,8 +104,6 @@ struct Rect { tl.y = pt.y; if (pt.y > br.y) br.y = pt.y; - Q_ASSERT(tl.x <= br.x); - Q_ASSERT(tl.y <= br.y); } void operator |= (const Rect &r) { @@ -117,8 +115,6 @@ struct Rect { br.x = r.br.x; if (r.br.y > br.y) br.y = r.br.y; - Q_ASSERT(tl.x <= br.x); - Q_ASSERT(tl.y <= br.y); } void map(const QMatrix4x4 &m); -- cgit v1.2.3