mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-18 22:11:32 +00:00
lottie: copy the data only necessarily.
This commit is contained in:
parent
5abe777118
commit
3b6b538a19
2 changed files with 12 additions and 16 deletions
|
@ -84,7 +84,7 @@ struct LottieStroke
|
|||
|
||||
struct LottieMask
|
||||
{
|
||||
LottiePathSet pathset = PathSet{nullptr, nullptr, 0, 0};
|
||||
LottiePathSet pathset;
|
||||
LottieOpacity opacity = 255;
|
||||
CompositeMethod method;
|
||||
bool inverse = false;
|
||||
|
@ -245,7 +245,7 @@ struct LottiePath : LottieShape
|
|||
if (pathset.frames) statical = false;
|
||||
}
|
||||
|
||||
LottiePathSet pathset = PathSet{nullptr, nullptr, 0, 0};
|
||||
LottiePathSet pathset;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -31,10 +31,10 @@
|
|||
|
||||
struct PathSet
|
||||
{
|
||||
Point* pts;
|
||||
PathCommand* cmds;
|
||||
uint16_t ptsCnt;
|
||||
uint16_t cmdsCnt;
|
||||
Point* pts = nullptr;
|
||||
PathCommand* cmds = nullptr;
|
||||
uint16_t ptsCnt = 0;
|
||||
uint16_t cmdsCnt = 0;
|
||||
};
|
||||
|
||||
|
||||
|
@ -253,8 +253,8 @@ struct LottieGenericProperty : LottieProperty
|
|||
{
|
||||
//shallow copy, used for slot overriding
|
||||
delete(frames);
|
||||
frames = other.frames;
|
||||
value = other.value;
|
||||
if (other.frames) frames = other.frames;
|
||||
else value = other.value;
|
||||
const_cast<T&>(other).frames = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
@ -269,10 +269,6 @@ struct LottiePathSet : LottieProperty
|
|||
Array<LottieScalarFrame<PathSet>>* frames = nullptr;
|
||||
PathSet value;
|
||||
|
||||
LottiePathSet(PathSet v) : value(v)
|
||||
{
|
||||
}
|
||||
|
||||
~LottiePathSet()
|
||||
{
|
||||
free(value.cmds);
|
||||
|
@ -447,8 +443,8 @@ struct LottieColorStop : LottieProperty
|
|||
{
|
||||
//shallow copy, used for slot overriding
|
||||
delete(frames);
|
||||
frames = other.frames;
|
||||
value = other.value;
|
||||
if (other.frames) frames = other.frames;
|
||||
else value = other.value;
|
||||
count = other.count;
|
||||
const_cast<LottieColorStop&>(other).frames = nullptr;
|
||||
return *this;
|
||||
|
@ -569,8 +565,8 @@ struct LottieTextDoc : LottieProperty
|
|||
{
|
||||
//shallow copy, used for slot overriding
|
||||
delete(frames);
|
||||
frames = other.frames;
|
||||
value = other.value;
|
||||
if (other.frames) frames = other.frames;
|
||||
else value = other.value;
|
||||
const_cast<LottieTextDoc&>(other).frames = nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue