mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
sw_engine: fix a regression bug.
this matrix data is volatile since it's coming from stack memory. thus engine should record its own memory space for keeping it. Change-Id: I664dd56412f4d236ad04c312220c67da226274e5
This commit is contained in:
parent
28485d4b9c
commit
ad5f147c74
2 changed files with 10 additions and 5 deletions
|
@ -32,7 +32,7 @@ namespace tvg {
|
|||
SwShape shape;
|
||||
const Shape* sdata;
|
||||
SwSize clip;
|
||||
const Matrix* transform;
|
||||
Matrix* transform;
|
||||
RenderUpdateFlag flags;
|
||||
future<void> progress;
|
||||
};
|
||||
|
@ -139,6 +139,7 @@ bool SwRenderer::dispose(const Shape& sdata, void *data)
|
|||
if (!task) return true;
|
||||
if (task->progress.valid()) task->progress.get();
|
||||
shapeFree(task->shape);
|
||||
if (task->transform) free(task->transform);
|
||||
free(task);
|
||||
return true;
|
||||
}
|
||||
|
@ -158,8 +159,14 @@ void* SwRenderer::prepare(const Shape& sdata, void* data, const RenderTransform*
|
|||
task->sdata = &sdata;
|
||||
task->clip = {static_cast<SwCoord>(surface.w), static_cast<SwCoord>(surface.h)};
|
||||
|
||||
if (transform) task->transform = &transform->m;
|
||||
else task->transform = nullptr;
|
||||
if (transform) {
|
||||
if (!task->transform) task->transform = static_cast<Matrix*>(malloc(sizeof(Matrix)));
|
||||
assert(task->transform);
|
||||
*task->transform = transform->m;
|
||||
} else {
|
||||
if (task->transform) free(task->transform);
|
||||
task->transform = nullptr;
|
||||
}
|
||||
|
||||
task->flags = flags;
|
||||
|
||||
|
|
|
@ -201,7 +201,6 @@ static bool _updateBBox(SwOutline* outline, SwBBox& bbox)
|
|||
++pt;
|
||||
|
||||
for(uint32_t i = 1; i < outline->ptsCnt; ++i, ++pt) {
|
||||
assert(pt);
|
||||
if (xMin > pt->x) xMin = pt->x;
|
||||
if (xMax < pt->x) xMax = pt->x;
|
||||
if (yMin > pt->y) yMin = pt->y;
|
||||
|
@ -567,7 +566,6 @@ void shapeFree(SwShape& shape)
|
|||
{
|
||||
shapeDelOutline(shape);
|
||||
rleFree(shape.rle);
|
||||
|
||||
shapeDelFill(shape);
|
||||
|
||||
if (shape.stroke) {
|
||||
|
|
Loading…
Add table
Reference in a new issue