mPathChanged = false;
// 1. update the local path if needed
- if (!(mInit && mStaticPath) && hasChanged(frameNo)) {
+ if (hasChanged(frameNo)) {
updatePath(mLocalPath, frameNo);
- mInit = true;
mPathChanged = true;
+ mNeedUpdate = true;
}
mTemp = mLocalPath;
// 3. compute the final path with parentMatrix
-
if ((flag & DirtyFlagBit::Matrix) || mPathChanged) {
mMatrix = parentMatrix;
mPathChanged = true;
const VPath & LOTPathDataItem::finalPath()
{
- if (mPathChanged) {
+ if (mPathChanged || mNeedUpdate) {
mFinalPath.clone(mTemp);
mFinalPath.transform(mMatrix);
- mPathChanged = false;
+ mNeedUpdate = false;
}
return mFinalPath;
}
class LOTPathDataItem : public LOTContentItem
{
public:
- LOTPathDataItem(bool staticPath):mInit(false), mStaticPath(staticPath){}
+ LOTPathDataItem(bool staticPath): mStaticPath(staticPath){}
void update(int frameNo, const VMatrix &parentMatrix, float parentAlpha, const DirtyFlag &flag) final;
bool dirty() const {return mPathChanged;}
const VPath &localPath() const {return mTemp;}
const VPath &finalPath();
- void updatePath(const VPath &path) {mTemp.clone(path); mPathChanged = true;}
+ void updatePath(const VPath &path) {mTemp.clone(path); mPathChanged = true; mNeedUpdate = true;}
+ bool staticPath() const { return mStaticPath; }
private:
- bool mInit;
bool mStaticPath;
VPath mLocalPath;
VPath mTemp;
VPath mFinalPath;
VMatrix mMatrix;
bool mPathChanged{true};
+ bool mNeedUpdate{true};
protected:
virtual void updatePath(VPath& path, int frameNo) = 0;
virtual bool hasChanged(int frameNo) = 0;
mCache.mRoundness = roundness;
}
bool hasChanged(int frameNo) final {
+ if (mCache.mFrameNo != -1 && staticPath()) return false;
if (mCache.mFrameNo == frameNo) return false;
VPointF pos = mData->mPos.value(frameNo);
mCache.mSize = size;
}
bool hasChanged(int frameNo) final {
+ if (mCache.mFrameNo != -1 && staticPath()) return false;
if (mCache.mFrameNo == frameNo) return false;
VPointF pos = mData->mPos.value(frameNo);
mCache.mRotation = rotation;
}
bool hasChanged(int frameNo) final {
+ if (mCache.mFrameNo != -1 && staticPath()) return false;
if (mCache.mFrameNo == frameNo) return false;
VPointF pos = mData->mPos.value(frameNo);