mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-05 14:02:48 +00:00
lottie/vector: Remove the hack with mutable data member.
NOTE: if you need to modify the object in a const member function make the data as mutable. Change-Id: I28b2cc18d75433475f75b048af878297747980db
This commit is contained in:
parent
e6bce26b6e
commit
61bb4fba3e
@ -80,11 +80,10 @@ VMatrix::MatrixType VMatrix::type() const
|
|||||||
if(dirty == MatrixType::None || dirty < mType)
|
if(dirty == MatrixType::None || dirty < mType)
|
||||||
return mType;
|
return mType;
|
||||||
|
|
||||||
VMatrix::MatrixType newType;
|
|
||||||
switch (dirty) {
|
switch (dirty) {
|
||||||
case MatrixType::Project:
|
case MatrixType::Project:
|
||||||
if (!vIsZero(m13) || !vIsZero(m23) || !vIsZero(m33 - 1)) {
|
if (!vIsZero(m13) || !vIsZero(m23) || !vIsZero(m33 - 1)) {
|
||||||
newType = MatrixType::Project;
|
mType = MatrixType::Project;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MatrixType::Shear:
|
case MatrixType::Shear:
|
||||||
@ -92,29 +91,28 @@ VMatrix::MatrixType VMatrix::type() const
|
|||||||
if (!vIsZero(m12) || !vIsZero(m21)) {
|
if (!vIsZero(m12) || !vIsZero(m21)) {
|
||||||
const float dot = m11 * m12 + m21 * m22;
|
const float dot = m11 * m12 + m21 * m22;
|
||||||
if (vIsZero(dot))
|
if (vIsZero(dot))
|
||||||
newType = MatrixType::Rotate;
|
mType = MatrixType::Rotate;
|
||||||
else
|
else
|
||||||
newType = MatrixType::Shear;
|
mType = MatrixType::Shear;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MatrixType::Scale:
|
case MatrixType::Scale:
|
||||||
if (!vIsZero(m11 - 1) || !vIsZero(m22 - 1)) {
|
if (!vIsZero(m11 - 1) || !vIsZero(m22 - 1)) {
|
||||||
newType = MatrixType::Scale;
|
mType = MatrixType::Scale;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MatrixType::Translate:
|
case MatrixType::Translate:
|
||||||
if (!vIsZero(mtx) || !vIsZero(mty)) {
|
if (!vIsZero(mtx) || !vIsZero(mty)) {
|
||||||
newType = MatrixType::Translate;
|
mType = MatrixType::Translate;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MatrixType::None:
|
case MatrixType::None:
|
||||||
newType = MatrixType::None;
|
mType = MatrixType::None;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const_cast<VMatrix *>(this)->dirty = MatrixType::None;
|
dirty = MatrixType::None;
|
||||||
const_cast<VMatrix *>(this)->mType = newType;
|
return mType;
|
||||||
return newType;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -59,8 +59,8 @@ public:
|
|||||||
friend std::ostream& operator<<(std::ostream& os, const VMatrix& o);
|
friend std::ostream& operator<<(std::ostream& os, const VMatrix& o);
|
||||||
private:
|
private:
|
||||||
friend struct VSpanData;
|
friend struct VSpanData;
|
||||||
MatrixType mType{MatrixType::None};
|
mutable MatrixType mType{MatrixType::None};
|
||||||
MatrixType dirty{MatrixType::None};
|
mutable MatrixType dirty{MatrixType::None};
|
||||||
float m11{1}, m12{0}, m13{0};
|
float m11{1}, m12{0}, m13{0};
|
||||||
float m21{0}, m22{1}, m23{0};
|
float m21{0}, m22{1}, m23{0};
|
||||||
float mtx{0}, mty{0}, m33{1};
|
float mtx{0}, mty{0}, m33{1};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user