mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-07 14:53:35 +00:00
lottie/vector: add clone method to copy data without increasing ref count
It helps to improve performance by avoiding copy job from writing COW data. Change-Id: I72d1c7106fc4fe53fa6db05e7ed8c74f1b70fe95
This commit is contained in:
parent
3ef4a6b6ae
commit
a9def49291
@ -692,7 +692,7 @@ void LOTPathDataItem::update(int frameNo, const VMatrix &parentMatrix,
|
|||||||
// 3. compute the final path with parentMatrix
|
// 3. compute the final path with parentMatrix
|
||||||
|
|
||||||
if ((flag & DirtyFlagBit::Matrix) || mPathChanged) {
|
if ((flag & DirtyFlagBit::Matrix) || mPathChanged) {
|
||||||
mFinalPath = tempPath;
|
mFinalPath.clone(tempPath);
|
||||||
mFinalPath.transform(parentMatrix);
|
mFinalPath.transform(parentMatrix);
|
||||||
mPathChanged = true;
|
mPathChanged = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,6 +45,7 @@ public:
|
|||||||
float length() const;
|
float length() const;
|
||||||
const std::vector<VPath::Element> &elements() const;
|
const std::vector<VPath::Element> &elements() const;
|
||||||
const std::vector<VPointF> & points() const;
|
const std::vector<VPointF> & points() const;
|
||||||
|
void clone(const VPath &srcPath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct VPathData {
|
struct VPathData {
|
||||||
@ -210,6 +211,11 @@ inline const std::vector<VPointF> &VPath::points() const
|
|||||||
return d->points();
|
return d->points();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void VPath::clone(const VPath &srcPath)
|
||||||
|
{
|
||||||
|
d.write() = srcPath.d.read();
|
||||||
|
}
|
||||||
|
|
||||||
V_END_NAMESPACE
|
V_END_NAMESPACE
|
||||||
|
|
||||||
#endif // VPATH_H
|
#endif // VPATH_H
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user