summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
diff options
context:
space:
mode:
authorLeon Clarke <leonclarke@google.com>2010-07-15 12:03:35 +0100
committerLeon Clarke <leonclarke@google.com>2010-07-20 16:57:23 +0100
commite458d70a0d18538346f41b503114c9ebe6b2ce12 (patch)
tree86f1637deca2c524432a822e5fcedd4bef221091 /WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
parentf43eabc081f7ce6af24b9df4953498a3cd6ca24d (diff)
downloadexternal_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.zip
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.gz
external_webkit-e458d70a0d18538346f41b503114c9ebe6b2ce12.tar.bz2
Merge WebKit at r63173 : Initial merge by git.
Change-Id: Ife5af0c7c6261fbbc8ae6bc08c390efa9ef10b44
Diffstat (limited to 'WebCore/platform/graphics/qt/GraphicsLayerQt.cpp')
-rw-r--r--WebCore/platform/graphics/qt/GraphicsLayerQt.cpp41
1 files changed, 39 insertions, 2 deletions
diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
index 226f1fb..89badcc 100644
--- a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
@@ -28,6 +28,7 @@
#include "TranslateTransformOperation.h"
#include "UnitBezier.h"
#include <QtCore/qabstractanimation.h>
+#include <QtCore/qdatetime.h>
#include <QtCore/qdebug.h>
#include <QtCore/qmetaobject.h>
#include <QtCore/qset.h>
@@ -45,6 +46,8 @@
#define QT_DEBUG_RECACHE 0
#define QT_DEBUG_CACHEDUMP 0
+#define QT_DEBUG_FPS 0
+
namespace WebCore {
#ifndef QT_NO_GRAPHICSEFFECT
@@ -1184,6 +1187,15 @@ void GraphicsLayerQt::syncCompositingState()
}
/* \reimp (GraphicsLayer.h)
+*/
+void GraphicsLayerQt::syncCompositingStateForThisLayerOnly()
+{
+ // We can't call flushChanges recursively here
+ m_impl->flushChanges(false);
+ GraphicsLayer::syncCompositingStateForThisLayerOnly();
+}
+
+/* \reimp (GraphicsLayer.h)
*/
NativeLayer GraphicsLayerQt::nativeLayer() const
{
@@ -1323,6 +1335,22 @@ protected:
// This is the part that differs between animated properties.
virtual void applyFrame(const T& fromValue, const T& toValue, qreal progress) = 0;
+ virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
+ {
+#if QT_DEBUG_FPS
+ if (newState == Running && oldState == Stopped) {
+ qDebug("Animation Started!");
+ m_fps.frames = 0;
+ m_fps.duration.start();
+ } else if (newState == Stopped && oldState == Running) {
+ const int duration = m_fps.duration.elapsed();
+ qDebug("Animation Ended! %dms [%f FPS]", duration,
+ (1000 / (((float)duration) / m_fps.frames)));
+ }
+#endif
+ AnimationQtBase::updateState(newState, oldState);
+ }
+
virtual void updateCurrentTime(int currentTime)
{
if (!m_layer)
@@ -1362,9 +1390,18 @@ protected:
progress = (!progress || progress == 1 || it.key() == it2.key()) ?
progress : applyTimingFunction(timingFunc, (progress - it.key()) / (it2.key() - it.key()), duration());
applyFrame(fromValue, toValue, progress);
+#if QT_DEBUG_FPS
+ ++m_fps.frames;
+#endif
}
QMap<qreal, KeyframeValueQt<T> > m_keyframeValues;
+#if QT_DEBUG_FPS
+ struct {
+ QTime duration;
+ int frames;
+ } m_fps;
+#endif
};
class TransformAnimationQt : public AnimationQt<TransformOperations> {
@@ -1416,7 +1453,7 @@ public:
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
- AnimationQtBase::updateState(newState, oldState);
+ AnimationQt<TransformOperations>::updateState(newState, oldState);
if (!m_layer)
return;
@@ -1467,7 +1504,7 @@ public:
virtual void updateState(QAbstractAnimation::State newState, QAbstractAnimation::State oldState)
{
- QAbstractAnimation::updateState(newState, oldState);
+ AnimationQt<qreal>::updateState(newState, oldState);
if (m_layer)
m_layer.data()->m_opacityAnimationRunning = (newState == QAbstractAnimation::Running);