mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
sw_engine: fix too small memory alloc for spans
In some clipping cases, the memory allocated for storing spans was too small. As a result, the entire clipped area might not have been rendered. This has been resolved by adding an experimental factor to increase the size of allocated memory. @issue: https://github.com/thorvg/thorvg/issues/3461
This commit is contained in:
parent
1d0973cdf0
commit
1b72113fcc
1 changed files with 1 additions and 1 deletions
|
@ -997,7 +997,7 @@ void rleFree(SwRle* rle)
|
|||
bool rleClip(SwRle *rle, const SwRle *clip)
|
||||
{
|
||||
if (rle->size == 0 || clip->size == 0) return false;
|
||||
auto spanCnt = rle->size > clip->size ? rle->size : clip->size;
|
||||
auto spanCnt = 2 * (rle->size > clip->size ? rle->size : clip->size); //factor 2 added for safety (no real cases observed where the factor exceeded 1.4)
|
||||
auto spans = tvg::malloc<SwSpan*>(sizeof(SwSpan) * (spanCnt));
|
||||
auto spansEnd = _intersectSpansRegion(clip, rle, spans, spanCnt);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue