Tolerate NaN in the geometry without asserting
authorGunnar Sletta <gunnar.sletta@digia.com>
Mon, 4 Nov 2013 14:45:22 +0000 (15:45 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Mon, 4 Nov 2013 21:00:14 +0000 (22:00 +0100)
If we come across NaN geometry, we treat it as spanning
the entire viewport, similar to other geometries with
undefined geometry.

Task-number: QTBUG-34520
Change-Id: Ia4171f9f13d876c6c587043ad7decaa19bb85f01
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
src/quick/scenegraph/coreapi/qsgbatchrenderer.cpp

index c27217b..bb98682 100644 (file)
@@ -553,6 +553,15 @@ void Element::computeBounds()
         vd += g->sizeOfVertex();
     }
     bounds.map(*node->matrix());
+
+    if (!qIsFinite(bounds.tl.x))
+        bounds.tl.x = -FLT_MAX;
+    if (!qIsFinite(bounds.tl.y))
+        bounds.tl.y = -FLT_MAX;
+    if (!qIsFinite(bounds.br.x))
+        bounds.br.x = FLT_MAX;
+    if (!qIsFinite(bounds.br.y))
+        bounds.br.y = FLT_MAX;
 }
 
 RenderNodeElement::~RenderNodeElement()