mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
sw_engine: optimize memory allocation.
there are a logical wrong that memory increase size, it correct that also tune the number to reduce memory allocation time. Now scene transform test works smoothly. Change-Id: If0674e33426d794546801a96ad9de711b5de0dcd
This commit is contained in:
parent
b212df1061
commit
9ffc1d40f6
1 changed files with 2 additions and 2 deletions
|
@ -147,9 +147,9 @@ static void _genSpan(SwRleData* rle, SwSpan* spans, uint32_t count)
|
||||||
/* alloc is required to prevent free and reallocation */
|
/* alloc is required to prevent free and reallocation */
|
||||||
/* when the rle needs to be regenerated because of attribute change. */
|
/* when the rle needs to be regenerated because of attribute change. */
|
||||||
if (rle->alloc < newSize) {
|
if (rle->alloc < newSize) {
|
||||||
rle->spans = static_cast<SwSpan*>(realloc(rle->spans, (count + rle->size) << 2 * sizeof(SwSpan)));
|
rle->alloc = (newSize * 2);
|
||||||
|
rle->spans = static_cast<SwSpan*>(realloc(rle->spans, rle->alloc * sizeof(SwSpan)));
|
||||||
assert(rle->spans);
|
assert(rle->spans);
|
||||||
rle->alloc = rle->size + (count << 2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//copy the new spans to the allocated memory
|
//copy the new spans to the allocated memory
|
||||||
|
|
Loading…
Add table
Reference in a new issue