Title: [106190] trunk/Source/WebCore
Revision
106190
Author
[email protected]
Date
2012-01-28 11:02:34 -0800 (Sat, 28 Jan 2012)

Log Message

Get rid of TransformOperationList
https://bugs.webkit.org/show_bug.cgi?id=77249

Reviewed by Dan Bernstein.

Changed fetchTransformOperationList to validateTransformOperations and got rid of separately generated list
of transform operations. These are not needed, they are already available in the keyframe lists and they
make it more difficult to add support for hardware animated filters. No behavior changes.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::validateTransformOperations):
* platform/graphics/GraphicsLayer.h:
(GraphicsLayer):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
(WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
* platform/graphics/ca/GraphicsLayerCA.h:
():
* platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
(WebCore::GraphicsLayerTextureMapper::addAnimation):
* platform/graphics/texmap/TextureMapperAnimation.cpp:
(WebCore::applyTransformAnimation):
(WebCore::TextureMapperAnimation::TextureMapperAnimation):
(WebCore::TextureMapperAnimation::applyInternal):
* platform/graphics/texmap/TextureMapperAnimation.h:
(TextureMapperAnimation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106189 => 106190)


--- trunk/Source/WebCore/ChangeLog	2012-01-28 15:23:19 UTC (rev 106189)
+++ trunk/Source/WebCore/ChangeLog	2012-01-28 19:02:34 UTC (rev 106190)
@@ -1,3 +1,33 @@
+2012-01-27  Chris Marrin  <[email protected]>
+
+        Get rid of TransformOperationList
+        https://bugs.webkit.org/show_bug.cgi?id=77249
+
+        Reviewed by Dan Bernstein.
+
+        Changed fetchTransformOperationList to validateTransformOperations and got rid of separately generated list
+        of transform operations. These are not needed, they are already available in the keyframe lists and they
+        make it more difficult to add support for hardware animated filters. No behavior changes.
+
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::validateTransformOperations):
+        * platform/graphics/GraphicsLayer.h:
+        (GraphicsLayer):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::appendToUncommittedAnimations):
+        (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes):
+        * platform/graphics/ca/GraphicsLayerCA.h:
+        ():
+        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
+        (WebCore::GraphicsLayerTextureMapper::addAnimation):
+        * platform/graphics/texmap/TextureMapperAnimation.cpp:
+        (WebCore::applyTransformAnimation):
+        (WebCore::TextureMapperAnimation::TextureMapperAnimation):
+        (WebCore::TextureMapperAnimation::applyInternal):
+        * platform/graphics/texmap/TextureMapperAnimation.h:
+        (TextureMapperAnimation):
+
 2012-01-27  Raymond Toy  <[email protected]>
 
         AudioPannerNode::setPanningModel() does not update m_panningModel properly

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (106189 => 106190)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-01-28 15:23:19 UTC (rev 106189)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-01-28 19:02:34 UTC (rev 106190)
@@ -385,16 +385,14 @@
     return static_cast<const TransformAnimationValue*>(valueList.at(index))->value();
 }
 
-void GraphicsLayer::fetchTransformOperationList(const KeyframeValueList& valueList, TransformOperationList& list, bool& isValid, bool& hasBigRotation)
+int GraphicsLayer::validateTransformOperations(const KeyframeValueList& valueList, bool& hasBigRotation)
 {
     ASSERT(valueList.property() == AnimatedPropertyWebkitTransform);
 
-    list.clear();
-    isValid = false;
     hasBigRotation = false;
     
     if (valueList.size() < 2)
-        return;
+        return -1;
     
     // Empty transforms match anything, so find the first non-empty entry as the reference.
     size_t firstIndex = 0;
@@ -404,7 +402,7 @@
     }
     
     if (firstIndex >= valueList.size())
-        return;
+        return -1;
         
     const TransformOperations* firstVal = operationsAt(valueList, firstIndex);
     
@@ -417,19 +415,15 @@
             continue;
             
         if (!firstVal->operationsMatch(*val))
-            return;
+            return -1;
     }
 
-    // Keyframes are valid, fill in the list.
-    isValid = true;
-    
+    // Keyframes are valid, check for big rotations.    
     double lastRotAngle = 0.0;
     double maxRotAngle = -1.0;
         
-    list.resize(firstVal->operations().size());
     for (size_t j = 0; j < firstVal->operations().size(); ++j) {
         TransformOperation::OperationType type = firstVal->operations().at(j)->getOperationType();
-        list[j] = type;
         
         // if this is a rotation entry, we need to see if any angle differences are >= 180 deg
         if (type == TransformOperation::ROTATE_X ||
@@ -453,6 +447,8 @@
     }
     
     hasBigRotation = maxRotAngle >= 180.0;
+    
+    return firstIndex;
 }
 
 

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (106189 => 106190)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-01-28 15:23:19 UTC (rev 106189)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-01-28 19:02:34 UTC (rev 106190)
@@ -423,10 +423,12 @@
     void clearFilters() { m_filters.clear(); }
 #endif
 
-    typedef Vector<TransformOperation::OperationType> TransformOperationList;
-    // Given a list of TransformAnimationValues, return an array of transform operations.
-    // On return, if hasBigRotation is true, functions contain rotations of >= 180 degrees
-    static void fetchTransformOperationList(const KeyframeValueList&, TransformOperationList&, bool& isValid, bool& hasBigRotation);
+    // Given a list of TransformAnimationValues, see if all the operations for each keyframe match. If so
+    // return the index of the KeyframeValueList entry that has that list of operations (it may not be
+    // the first entry because some keyframes might have an empty transform and those match any list).
+    // If the lists don't match return -1. On return, if hasBigRotation is true, functions contain 
+    // rotations of >= 180 degrees
+    static int validateTransformOperations(const KeyframeValueList&, bool& hasBigRotation);
 
     virtual void setOpacityInternal(float) { }
 

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (106189 => 106190)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-01-28 15:23:19 UTC (rev 106189)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-01-28 19:02:34 UTC (rev 106190)
@@ -1756,9 +1756,9 @@
     return true;
 }
 
-bool GraphicsLayerCA::appendToUncommittedAnimations(const KeyframeValueList& valueList, const TransformOperationList& functionList, const Animation* animation, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation)
+bool GraphicsLayerCA::appendToUncommittedAnimations(const KeyframeValueList& valueList, const TransformOperations* operations, const Animation* animation, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation)
 {
-    TransformOperation::OperationType transformOp = isMatrixAnimation ? TransformOperation::MATRIX_3D : functionList[animationIndex];
+    TransformOperation::OperationType transformOp = isMatrixAnimation ? TransformOperation::MATRIX_3D : operations->operations().at(animationIndex)->getOperationType();
     bool additive = animationIndex > 0;
     bool isKeyframe = valueList.size() > 2;
 
@@ -1783,23 +1783,23 @@
 {
     ASSERT(valueList.property() == AnimatedPropertyWebkitTransform);
 
-    TransformOperationList functionList;
-    bool listsMatch, hasBigRotation;
-    fetchTransformOperationList(valueList, functionList, listsMatch, hasBigRotation);
+    bool hasBigRotation;
+    int listIndex = validateTransformOperations(valueList, hasBigRotation);
+    const TransformOperations* operations = (listIndex >= 0) ? static_cast<const TransformAnimationValue*>(valueList.at(listIndex))->value() : 0;
 
     // We need to fall back to software animation if we don't have setValueFunction:, and
     // we would need to animate each incoming transform function separately. This is the
     // case if we have a rotation >= 180 or we have more than one transform function.
-    if ((hasBigRotation || functionList.size() > 1) && !PlatformCAAnimation::supportsValueFunction())
+    if ((hasBigRotation || (operations && operations->size() > 1)) && !PlatformCAAnimation::supportsValueFunction())
         return false;
 
     bool validMatrices = true;
 
-    // If functionLists don't match we do a matrix animation, otherwise we do a component hardware animation.
+    // If function lists don't match we do a matrix animation, otherwise we do a component hardware animation.
     // Also, we can't do component animation unless we have valueFunction, so we need to do matrix animation
     // if that's not true as well.
-    bool isMatrixAnimation = !listsMatch || !PlatformCAAnimation::supportsValueFunction();
-    int numAnimations = isMatrixAnimation ? 1 : functionList.size();
+    bool isMatrixAnimation = listIndex < 0 || !PlatformCAAnimation::supportsValueFunction();
+    int numAnimations = isMatrixAnimation ? 1 : operations->size();
 
     bool reverseAnimationList = true;
 #if !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(WIN)
@@ -1814,14 +1814,14 @@
 #endif
     if (reverseAnimationList) {
         for (int animationIndex = numAnimations - 1; animationIndex >= 0; --animationIndex) {
-            if (!appendToUncommittedAnimations(valueList, functionList, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
+            if (!appendToUncommittedAnimations(valueList, operations, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
                 validMatrices = false;
                 break;
             }
         }
     } else {
         for (int animationIndex = 0; animationIndex < numAnimations; ++animationIndex) {
-            if (!appendToUncommittedAnimations(valueList, functionList, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
+            if (!appendToUncommittedAnimations(valueList, operations, animation, animationName, boxSize, animationIndex, timeOffset, isMatrixAnimation)) {
                 validMatrices = false;
                 break;
             }

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (106189 => 106190)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2012-01-28 15:23:19 UTC (rev 106189)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h	2012-01-28 19:02:34 UTC (rev 106190)
@@ -321,7 +321,7 @@
     static void moveOrCopyLayerAnimation(MoveOrCopy, const String& animationIdentifier, PlatformCALayer *fromLayer, PlatformCALayer *toLayer);
     void moveOrCopyAnimationsForProperty(MoveOrCopy, AnimatedPropertyID, PlatformCALayer * fromLayer, PlatformCALayer * toLayer);
     
-    bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperationList&, const Animation*, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation);
+    bool appendToUncommittedAnimations(const KeyframeValueList&, const TransformOperations*, const Animation*, const String& animationName, const IntSize& boxSize, int animationIndex, double timeOffset, bool isMatrixAnimation);
     
     enum LayerChange {
         NoChange = 0,

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (106189 => 106190)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2012-01-28 15:23:19 UTC (rev 106189)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2012-01-28 19:02:34 UTC (rev 106190)
@@ -365,14 +365,13 @@
     if (!anim || anim->isEmptyOrZeroDuration() || valueList.size() < 2 || (valueList.property() != AnimatedPropertyWebkitTransform && valueList.property() != AnimatedPropertyOpacity))
         return false;
 
-    bool listsMatch;
+    bool listsMatch = false;
     bool hasBigRotation;
-    Vector<TransformOperation::OperationType> functionList;
 
     if (valueList.property() == AnimatedPropertyWebkitTransform)
-        fetchTransformOperationList(valueList, functionList, listsMatch, hasBigRotation);
+        listsMatch = validateTransformOperations(valueList, hasBigRotation) >= 0;
 
-    m_animations.add(keyframesName, TextureMapperAnimation(valueList, boxSize, anim, timeOffset, functionList, listsMatch));
+    m_animations.add(keyframesName, TextureMapperAnimation(valueList, boxSize, anim, timeOffset, listsMatch));
     notifyChange(TextureMapperNode::AnimationChange);
     m_animationStartedTimer.startOneShot(0);
     return true;

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp (106189 => 106190)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp	2012-01-28 15:23:19 UTC (rev 106189)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp	2012-01-28 19:02:34 UTC (rev 106190)
@@ -85,7 +85,7 @@
     return progress;
 }
 
-static TransformationMatrix applyTransformAnimation(const TransformOperations* from, const TransformOperations* to, double progress, const IntSize& boxSize, const Vector<TransformOperation::OperationType> functionList, bool listsMatch)
+static TransformationMatrix applyTransformAnimation(const TransformOperations* from, const TransformOperations* to, double progress, const IntSize& boxSize, bool listsMatch)
 {
     TransformationMatrix matrix;
 
@@ -134,11 +134,10 @@
 }
 
 
-TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, const Vector<TransformOperation::OperationType>& functionList, bool listsMatch)
+TextureMapperAnimation::TextureMapperAnimation(const KeyframeValueList& keyframes, const IntSize& boxSize, const Animation* animation, double timeOffset, bool listsMatch)
     : m_keyframes(keyframes)
     , m_boxSize(boxSize)
     , m_animation(Animation::create(animation))
-    , m_functionList(functionList)
     , m_listsMatch(listsMatch)
     , m_startTime(WTF::currentTime() - timeOffset)
     , m_pauseTime(0)
@@ -153,7 +152,7 @@
         client->setOpacity(applyOpacityAnimation((static_cast<const FloatAnimationValue*>(from)->value()), (static_cast<const FloatAnimationValue*>(to)->value()), progress));
         return;
     case AnimatedPropertyWebkitTransform:
-        client->setTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_functionList, m_listsMatch));
+        client->setTransform(applyTransformAnimation(static_cast<const TransformAnimationValue*>(from)->value(), static_cast<const TransformAnimationValue*>(to)->value(), progress, m_boxSize, m_listsMatch));
         return;
     default:
         ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h (106189 => 106190)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h	2012-01-28 15:23:19 UTC (rev 106189)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h	2012-01-28 19:02:34 UTC (rev 106190)
@@ -41,7 +41,7 @@
     TextureMapperAnimation()
         : m_keyframes(AnimatedPropertyInvalid)
     { }
-    TextureMapperAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, const Vector<TransformOperation::OperationType>&, bool);
+    TextureMapperAnimation(const KeyframeValueList&, const IntSize&, const Animation*, double, bool);
     void apply(TextureMapperAnimationClient*);
     void pause(double);
     AnimationState state() const { return m_state; }
@@ -55,7 +55,6 @@
     IntSize m_boxSize;
     RefPtr<Animation> m_animation;
     String m_name;
-    Vector<TransformOperation::OperationType> m_functionList;
     bool m_listsMatch;
     bool m_hasBigRotation;
     double m_startTime;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to