sw_engine rleClipPath: Modify clippath spans creation size.
authorJunsuChoi <jsuya.choi@samsung.com>
Mon, 15 Mar 2021 06:05:24 +0000 (15:05 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Tue, 16 Mar 2021 01:05:51 +0000 (10:05 +0900)
When updating rle for clipped area, realloc size should be larger than spans size.
so this patch prevents the problem while realloc.

src/lib/sw_engine/tvgSwRle.cpp

index e89590b..846bca4 100644 (file)
@@ -923,8 +923,9 @@ void updateRleSpans(SwRleData *rle, const SwSpan* curSpans, uint32_t size)
     }
 
     if (!rle->spans || !curSpans) return;
+    rle->alloc = size * 2;
+    rle->spans = static_cast<SwSpan*>(realloc(rle->spans, rle->alloc * sizeof(SwSpan)));
     rle->size = size;
-    rle->spans = static_cast<SwSpan*>(realloc(rle->spans, rle->size * sizeof(SwSpan)));
 
     if (!rle->spans) return;