From c926eebba1612bbd18700fae25cd1a631b4b63c2 Mon Sep 17 00:00:00 2001 From: Sergii Liebodkin Date: Thu, 10 Oct 2024 16:53:37 +0000 Subject: [PATCH] wg_engine: fix empty shape aabb handling see https://github.com/thorvg/thorvg/issues/2843: --- src/renderer/wg_engine/tvgWgRenderData.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/renderer/wg_engine/tvgWgRenderData.cpp b/src/renderer/wg_engine/tvgWgRenderData.cpp index 33b14ccb..6ddb37a3 100755 --- a/src/renderer/wg_engine/tvgWgRenderData.cpp +++ b/src/renderer/wg_engine/tvgWgRenderData.cpp @@ -411,9 +411,12 @@ void WgRenderDataShape::updateMeshes(WgContext &context, const RenderShape &rsha }); } } - // update shapes bbox - updateAABB(tr); - meshDataBBox.update(context, pMin, pMax); + // update shapes bbox (with empty path hadnling) + if ((this->meshGroupShapesBBox.meshes.count > 0 ) || + (this->meshGroupStrokesBBox.meshes.count > 0)) { + updateAABB(tr); + meshDataBBox.update(context, pMin, pMax); + } else aabb = {0, 0, 0, 0}; } @@ -450,6 +453,7 @@ void WgRenderDataShape::releaseMeshes(WgContext &context) meshGroupShapes.release(context); pMin = {FLT_MAX, FLT_MAX}; pMax = {0.0f, 0.0f}; + aabb = {0, 0, 0, 0}; clips.clear(); }