mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
tvg_loader interpreter: tiny optmization
skip memory copy as possible.
This commit is contained in:
parent
6b132d77e8
commit
c31c77c0fb
4 changed files with 4 additions and 6 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -87,9 +87,8 @@ static bool _parsePaintProperty(TvgBinBlock block, Paint *paint)
|
||||||
}
|
}
|
||||||
case TVG_TAG_PAINT_TRANSFORM: {
|
case TVG_TAG_PAINT_TRANSFORM: {
|
||||||
if (block.length != SIZE(Matrix)) return false;
|
if (block.length != SIZE(Matrix)) return false;
|
||||||
Matrix matrix;
|
auto transform = (Matrix*)(block.data);
|
||||||
memcpy(&matrix, block.data, SIZE(Matrix));
|
paint->transform(*transform);
|
||||||
paint->transform(matrix);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
case TVG_TAG_PAINT_CMP_TARGET: {
|
case TVG_TAG_PAINT_CMP_TARGET: {
|
||||||
|
@ -227,9 +226,8 @@ static unique_ptr<Fill> _parseShapeFill(const char *ptr, const char *end)
|
||||||
}
|
}
|
||||||
case TVG_TAG_FILL_TRANSFORM: {
|
case TVG_TAG_FILL_TRANSFORM: {
|
||||||
if (!fillGrad || block.length != SIZE(Matrix)) return nullptr;
|
if (!fillGrad || block.length != SIZE(Matrix)) return nullptr;
|
||||||
Matrix gradTransform;
|
auto transform = (Matrix*)(block.data);
|
||||||
memcpy(&gradTransform, block.data, SIZE(Matrix));
|
fillGrad->transform(*transform);
|
||||||
fillGrad->transform(gradTransform);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
|
|
Loading…
Add table
Reference in a new issue