summaryrefslogtreecommitdiffstats
path: root/src/svg/qsvgstyle_p.h
diff options
context:
space:
mode:
authorJason Barron <jbarron@trolltech.com>2009-08-20 14:58:58 (GMT)
committerJason Barron <jbarron@trolltech.com>2009-08-20 14:58:58 (GMT)
commit851a858fcd28c35dff2ffbeffdb40f7ee69f45b4 (patch)
treef76f604982f127af7ef66d904038cdfa705ff3af /src/svg/qsvgstyle_p.h
parentefea248b4b725ca429793874eb168ad4b43c7994 (diff)
parentc0b24b7ce12387aff6e74b05b4060c61a58d87e0 (diff)
downloadQt-851a858fcd28c35dff2ffbeffdb40f7ee69f45b4.zip
Qt-851a858fcd28c35dff2ffbeffdb40f7ee69f45b4.tar.gz
Qt-851a858fcd28c35dff2ffbeffdb40f7ee69f45b4.tar.bz2
Merge commit 'qt/master'
Conflicts: examples/painting/svgviewer/files/bubbles.svg src/corelib/kernel/qobject.cpp src/network/kernel/qhostinfo.cpp tests/auto/qhostinfo/tst_qhostinfo.cpp
Diffstat (limited to 'src/svg/qsvgstyle_p.h')
-rw-r--r--src/svg/qsvgstyle_p.h41
1 files changed, 39 insertions, 2 deletions
diff --git a/src/svg/qsvgstyle_p.h b/src/svg/qsvgstyle_p.h
index c18a265..056b73b 100644
--- a/src/svg/qsvgstyle_p.h
+++ b/src/svg/qsvgstyle_p.h
@@ -250,7 +250,7 @@ public:
{
return m_style;
}
-
+
void setGradientId(const QString &Id)
{
m_gradientId = Id;
@@ -529,20 +529,56 @@ public:
SkewX,
SkewY
};
+ enum Additive
+ {
+ Sum,
+ Replace
+ };
public:
QSvgAnimateTransform(int startMs, int endMs, int by = 0);
- void setArgs(TransformType type, const QVector<qreal> &args);
+ void setArgs(TransformType type, Additive additive, const QVector<qreal> &args);
void setFreeze(bool freeze);
void setRepeatCount(qreal repeatCount);
virtual void apply(QPainter *p, const QRectF &, QSvgNode *node, QSvgExtraStates &states);
virtual void revert(QPainter *p, QSvgExtraStates &states);
virtual Type type() const;
+ QSvgAnimateTransform::Additive additiveType() const
+ {
+ return m_additive;
+ }
+
+ bool animActive(qreal totalTimeElapsed)
+ {
+ if (totalTimeElapsed < m_from)
+ return false;
+ if (m_freeze || m_repeatCount < 0) // fill="freeze" or repeat="indefinite"
+ return true;
+ if (m_totalRunningTime == 0)
+ return false;
+ qreal animationFrame = (totalTimeElapsed - m_from) / m_totalRunningTime;
+ if (animationFrame > m_repeatCount)
+ return false;
+ return true;
+ }
+
+ bool transformApplied() const
+ {
+ return m_transformApplied;
+ }
+
+ // Call this instead of revert if you know that revert is unnecessary.
+ void clearTransformApplied()
+ {
+ m_transformApplied = false;
+ }
+
protected:
void resolveMatrix(QSvgNode *node);
private:
qreal m_from, m_to, m_by;
qreal m_totalRunningTime;
TransformType m_type;
+ Additive m_additive;
QVector<qreal> m_args;
int m_count;
QTransform m_transform;
@@ -550,6 +586,7 @@ private:
bool m_finished;
bool m_freeze;
qreal m_repeatCount;
+ bool m_transformApplied;
};