mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-24 10:52:56 +00:00
QTransform cleanup
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
parent
d7d4e5fda1
commit
50afdf1479
2 changed files with 510 additions and 465 deletions
File diff suppressed because it is too large
Load diff
|
@ -78,7 +78,7 @@ public:
|
|||
bool isRotating() const;
|
||||
bool isTranslating() const;
|
||||
|
||||
TransformationType type() const;
|
||||
inline TransformationType type() const;
|
||||
|
||||
inline qreal determinant() const;
|
||||
qreal det() const;
|
||||
|
@ -156,21 +156,22 @@ private:
|
|||
qreal h31, qreal h32, qreal h33, bool)
|
||||
: affine(h11, h12, h21, h22, h31, h32, true)
|
||||
, m_13(h13), m_23(h23), m_33(h33)
|
||||
, m_type(TxNone)
|
||||
, m_dirty(TxProject) {}
|
||||
, m_type(QTransform::TxNone)
|
||||
, m_dirty(QTransform::TxProject) {}
|
||||
inline QTransform(bool)
|
||||
: affine(true)
|
||||
, m_13(0), m_23(0), m_33(1)
|
||||
, m_type(TxNone)
|
||||
, m_dirty(TxNone) {}
|
||||
inline TransformationType inline_type() const;
|
||||
, m_type(QTransform::TxNone)
|
||||
, m_dirty(QTransform::TxNone) {}
|
||||
QMatrix affine;
|
||||
qreal m_13;
|
||||
qreal m_23;
|
||||
qreal m_33;
|
||||
|
||||
mutable uint m_type : 5;
|
||||
mutable uint m_dirty : 5;
|
||||
TransformationType m_type;
|
||||
TransformationType m_dirty;
|
||||
|
||||
void updateType();
|
||||
|
||||
class Private;
|
||||
Private *d;
|
||||
|
@ -178,20 +179,17 @@ private:
|
|||
Q_DECLARE_TYPEINFO(QTransform, Q_MOVABLE_TYPE);
|
||||
|
||||
/******* inlines *****/
|
||||
inline QTransform::TransformationType QTransform::inline_type() const
|
||||
QTransform::TransformationType QTransform::type() const
|
||||
{
|
||||
if (m_dirty == TxNone)
|
||||
return static_cast<TransformationType>(m_type);
|
||||
return type();
|
||||
return m_type;
|
||||
}
|
||||
|
||||
inline bool QTransform::isAffine() const
|
||||
{
|
||||
return inline_type() < TxProject;
|
||||
return type() < QTransform::TxProject;
|
||||
}
|
||||
inline bool QTransform::isIdentity() const
|
||||
{
|
||||
return inline_type() == TxNone;
|
||||
return type() == QTransform::TxNone;
|
||||
}
|
||||
|
||||
inline bool QTransform::isInvertible() const
|
||||
|
@ -201,16 +199,16 @@ inline bool QTransform::isInvertible() const
|
|||
|
||||
inline bool QTransform::isScaling() const
|
||||
{
|
||||
return type() >= TxScale;
|
||||
return type() >= QTransform::TxScale;
|
||||
}
|
||||
inline bool QTransform::isRotating() const
|
||||
{
|
||||
return inline_type() >= TxRotate;
|
||||
return type() >= QTransform::TxRotate;
|
||||
}
|
||||
|
||||
inline bool QTransform::isTranslating() const
|
||||
{
|
||||
return inline_type() >= TxTranslate;
|
||||
return type() >= QTransform::TxTranslate;
|
||||
}
|
||||
|
||||
inline qreal QTransform::determinant() const
|
||||
|
@ -280,8 +278,9 @@ inline QTransform &QTransform::operator*=(qreal num)
|
|||
affine._dx *= num;
|
||||
affine._dy *= num;
|
||||
m_33 *= num;
|
||||
if (m_dirty < TxScale)
|
||||
m_dirty = TxScale;
|
||||
if (m_dirty < QTransform::TxScale)
|
||||
m_dirty = QTransform::TxScale;
|
||||
updateType();
|
||||
return *this;
|
||||
}
|
||||
inline QTransform &QTransform::operator/=(qreal div)
|
||||
|
@ -304,7 +303,7 @@ inline QTransform &QTransform::operator+=(qreal num)
|
|||
affine._dx += num;
|
||||
affine._dy += num;
|
||||
m_33 += num;
|
||||
m_dirty = TxProject;
|
||||
m_dirty = QTransform::TxProject;
|
||||
return *this;
|
||||
}
|
||||
inline QTransform &QTransform::operator-=(qreal num)
|
||||
|
@ -320,7 +319,7 @@ inline QTransform &QTransform::operator-=(qreal num)
|
|||
affine._dx -= num;
|
||||
affine._dy -= num;
|
||||
m_33 -= num;
|
||||
m_dirty = TxProject;
|
||||
m_dirty = QTransform::TxProject;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue