mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-11-25 09:32:46 +00:00
lottie/model: refactored path direction handling.
Change-Id: I6a41f72e3635f3ad91f188d99868b3e8e44d3174
This commit is contained in:
parent
8779be1e9f
commit
95004fcf34
@ -655,15 +655,6 @@ void LOTShapeLayerItem::renderList(std::vector<VDrawable *> &list)
|
||||
mRoot->renderList(list);
|
||||
}
|
||||
|
||||
VPath::Direction LOTContentItem::direction(bool isCW)
|
||||
{
|
||||
if (isCW)
|
||||
return VPath::Direction::CW;
|
||||
else
|
||||
return VPath::Direction::CCW;
|
||||
}
|
||||
|
||||
|
||||
LOTContentGroupItem::LOTContentGroupItem(LOTShapeGroupData *data):mData(data)
|
||||
{
|
||||
addChildren(mData);
|
||||
@ -813,7 +804,7 @@ VPath LOTRectItem::getPath(int frameNo)
|
||||
VRectF r(pos.x() - size.x()/2, pos.y() - size.y()/2, size.x(), size.y());
|
||||
|
||||
VPath path;
|
||||
path.addRoundRect(r, radius, radius, direction(mData->isDirectionCW()));
|
||||
path.addRoundRect(r, radius, radius, mData->direction());
|
||||
|
||||
return path;
|
||||
}
|
||||
@ -830,7 +821,7 @@ VPath LOTEllipseItem::getPath(int frameNo)
|
||||
VRectF r(pos.x() - size.x()/2, pos.y() - size.y()/2, size.x(), size.y());
|
||||
|
||||
VPath path;
|
||||
path.addOval(r, direction(mData->isDirectionCW()));
|
||||
path.addOval(r, mData->direction());
|
||||
|
||||
return path;
|
||||
}
|
||||
@ -884,11 +875,11 @@ VPath LOTPolystarItem::getPath(int frameNo)
|
||||
path.addPolystarStar(0.0, 0.0, 0.0, points,
|
||||
innerRadius, outerRadius,
|
||||
innerRoundness, outerRoundness,
|
||||
direction(mData->isDirectionCW()));
|
||||
mData->direction());
|
||||
} else {
|
||||
path.addPolystarPolygon(0.0, 0.0, 0.0, points,
|
||||
outerRadius, outerRoundness,
|
||||
direction(mData->isDirectionCW()));
|
||||
mData->direction());
|
||||
}
|
||||
|
||||
m.translate(pos.x(), pos.y()).rotate(rotation);
|
||||
|
||||
@ -215,7 +215,6 @@ public:
|
||||
virtual ~LOTContentItem(){}
|
||||
virtual void update(int frameNo, const VMatrix &parentMatrix, float parentAlpha, const DirtyFlag &flag) = 0;
|
||||
virtual void renderList(std::vector<VDrawable *> &list){}
|
||||
VPath::Direction direction(bool isCW);
|
||||
};
|
||||
|
||||
class LOTContentGroupItem: public LOTContentItem
|
||||
|
||||
@ -608,8 +608,9 @@ public:
|
||||
class LOTPath : public LOTData
|
||||
{
|
||||
public:
|
||||
LOTPath(LOTData::Type type):LOTData(type), mDirection(3){}
|
||||
bool isDirectionCW() const { return ((mDirection == 3) ? false : true );}
|
||||
LOTPath(LOTData::Type type):LOTData(type), mDirection(1){}
|
||||
VPath::Direction direction() { if (mDirection == 3) return VPath::Direction::CCW;
|
||||
else return VPath::Direction::CW;}
|
||||
public:
|
||||
int mDirection;
|
||||
std::vector<std::shared_ptr<LOTData>> mPathOperations;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user