mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-14 12:04:29 +00:00
lottie: ++memory access stability
Internal matrix can be null. This update prevents such cases by using a safer API.
This commit is contained in:
parent
fdc1ad4d2c
commit
d6d4839f1a
1 changed files with 5 additions and 7 deletions
|
@ -1125,30 +1125,28 @@ static void _updateText(LottieLayer* layer, float frameNo)
|
|||
if (start > end) std::swap(start, end);
|
||||
|
||||
if (idx < start || idx >= end) continue;
|
||||
auto matrix = PP(shape.get())->transform();
|
||||
auto matrix = shape->transform();
|
||||
|
||||
shape->opacity((*s)->style.opacity(frameNo));
|
||||
|
||||
auto color = (*s)->style.fillColor(frameNo);
|
||||
shape->fill(color.rgb[0], color.rgb[1], color.rgb[2], (*s)->style.fillOpacity(frameNo));
|
||||
|
||||
rotate(matrix, (*s)->style.rotation(frameNo));
|
||||
rotate(&matrix, (*s)->style.rotation(frameNo));
|
||||
|
||||
auto glyphScale = (*s)->style.scale(frameNo) * 0.01f;
|
||||
tvg::scale(matrix, glyphScale.x, glyphScale.y);
|
||||
tvg::scale(&matrix, glyphScale.x, glyphScale.y);
|
||||
|
||||
auto position = (*s)->style.position(frameNo);
|
||||
translate(matrix, position.x, position.y);
|
||||
translate(&matrix, position.x, position.y);
|
||||
|
||||
shape->transform(*matrix);
|
||||
shape->transform(matrix);
|
||||
|
||||
if (doc.stroke.render) {
|
||||
auto strokeColor = (*s)->style.strokeColor(frameNo);
|
||||
|
||||
shape->strokeWidth((*s)->style.strokeWidth(frameNo) / scale);
|
||||
shape->strokeFill(strokeColor.rgb[0], strokeColor.rgb[1], strokeColor.rgb[2], (*s)->style.strokeOpacity(frameNo));
|
||||
}
|
||||
|
||||
cursor.x += (*s)->style.letterSpacing(frameNo);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue