mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-02-01 08:45:48 +00:00
lottie/render: don't redraw stroke/dash if there is no change
It will improve performance. Change-Id: I3764d126d7eae19d009d72998247789e620205a1
This commit is contained in:
committed by
Subhransu Mohanty
parent
10cb2bda92
commit
296534e3c0
@@ -31,6 +31,10 @@ VRle VDrawable::rle()
|
||||
void VDrawable::setStrokeInfo(CapStyle cap, JoinStyle join, float meterLimit,
|
||||
float strokeWidth)
|
||||
{
|
||||
if ((mStroke.cap == cap) && (mStroke.join == join) &&
|
||||
vCompare(mStroke.meterLimit, meterLimit) && vCompare(mStroke.width, strokeWidth))
|
||||
return;
|
||||
|
||||
mStroke.enable = true;
|
||||
mStroke.cap = cap;
|
||||
mStroke.join = join;
|
||||
@@ -41,6 +45,21 @@ void VDrawable::setStrokeInfo(CapStyle cap, JoinStyle join, float meterLimit,
|
||||
|
||||
void VDrawable::setDashInfo(float *array, int size)
|
||||
{
|
||||
bool hasChanged = false;
|
||||
|
||||
if (mStroke.dashArraySize == size) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
if (!vCompare(mStroke.dashArray[i], array[i])) {
|
||||
hasChanged = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
hasChanged = true;
|
||||
}
|
||||
|
||||
if (!hasChanged) return;
|
||||
|
||||
mStroke.dashArray = array;
|
||||
mStroke.dashArraySize = size;
|
||||
mFlag |= DirtyState::Path;
|
||||
|
||||
Reference in New Issue
Block a user