wg_engine: fix empty shape aabb handling

see https://github.com/thorvg/thorvg/issues/2843:
This commit is contained in:
Sergii Liebodkin 2024-10-10 16:53:37 +00:00 committed by Hermet Park
parent 0c08dab32f
commit c926eebba1

View file

@ -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();
}