Changeset 143369 in webkit
- Timestamp:
- Feb 19, 2013 12:10:11 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r143363 r143369 1 2013-02-19 ChangSeok Oh <changseok.oh@collabora.com> 2 3 [GTK][AC] Implement matrix transform animation with clutter ac backend 4 https://bugs.webkit.org/show_bug.cgi?id=109848 5 6 Reviewed by Gustavo Noronha Silva. 7 8 Clutter 1.12 doesn't support additive transform animations yet, so the combination 9 of two or more transformations(such as rotation after translation) runs unexpectedly. 10 So we use a matrix transformation instead for the case. 11 12 Covered by existing animation tests. 13 14 * platform/graphics/clutter/GraphicsLayerClutter.cpp: 15 (WebCore::getValueFunctionNameForTransformOperation): 16 (WebCore::GraphicsLayerClutter::createTransformAnimationsFromKeyframes): 17 * platform/graphics/clutter/PlatformClutterAnimation.cpp: 18 (WebCore::toClutterActorPropertyString): Add actor property "transform" 19 (WebCore::clutterMatrixProgress): Handle interpolation between two matrices instead of default clutter_matrix_progress. 20 (WebCore): 21 (WebCore::PlatformClutterAnimation::supportsAdditiveValueFunction): 22 (WebCore::PlatformClutterAnimation::setFromValue): for TransformationMatrix. 23 (WebCore::PlatformClutterAnimation::setToValue): ditto. 24 (WebCore::PlatformClutterAnimation::addClutterTransitionForProperty): 25 (WebCore::PlatformClutterAnimation::addTransformTransition): 26 * platform/graphics/clutter/PlatformClutterAnimation.h: 27 (PlatformClutterAnimation): 28 * platform/graphics/clutter/TransformationMatrixClutter.cpp: Add copy constructor for CoglMatrix. 29 (WebCore::TransformationMatrix::TransformationMatrix): 30 (WebCore): 31 * platform/graphics/transforms/TransformationMatrix.h: 32 (TransformationMatrix): 33 1 34 2013-02-19 Kassy Coan <kassycoan@chromium.org> 2 35 -
trunk/Source/WebCore/platform/graphics/clutter/GraphicsLayerClutter.cpp
r143343 r143369 191 191 case TransformOperation::TRANSLATE_3D: 192 192 return PlatformClutterAnimation::Translate; 193 case TransformOperation::MATRIX_3D: 194 return PlatformClutterAnimation::Matrix; 193 195 default: 194 196 return PlatformClutterAnimation::NoValueFunction; … … 926 928 // Also, we can't do component animation unless we have valueFunction, so we need to do matrix animation 927 929 // if that's not true as well. 928 bool isMatrixAnimation = listIndex < 0 || !PlatformClutterAnimation::supportsValueFunction() ;930 bool isMatrixAnimation = listIndex < 0 || !PlatformClutterAnimation::supportsValueFunction() || (operations->size() >= 2 && !PlatformClutterAnimation::supportsAdditiveValueFunction()); 929 931 int numAnimations = isMatrixAnimation ? 1 : operations->size(); 930 932 -
trunk/Source/WebCore/platform/graphics/clutter/PlatformClutterAnimation.cpp
r143343 r143369 57 57 // ClutterActor doesn't have 'scale' and 'translate' properties. So we should support 58 58 // 'scale' and 'translate' ValueFunctionType by combination of existing property animations. 59 const char* clutterActorProperty[] = { "NoProperty", "rotation-angle-x", "rotation-angle-y", "rotation-angle-z", "scale-x", "scale-y", "scale-z", "scale", "translation-x", "translation-y", "translation-z", "translate" };59 const char* clutterActorProperty[] = { "NoProperty", "rotation-angle-x", "rotation-angle-y", "rotation-angle-z", "scale-x", "scale-y", "scale-z", "scale", "translation-x", "translation-y", "translation-z", "translate", "transform" }; 60 60 return clutterActorProperty[valueFunctionType]; 61 61 } … … 86 86 } 87 87 88 static gboolean clutterMatrixProgress(const GValue* fromValue, const GValue* toValue, gdouble progress, GValue* returnValue) 89 { 90 const CoglMatrix* fromCoglMatrix = static_cast<CoglMatrix*>(g_value_get_boxed(fromValue)); 91 const CoglMatrix* toCoglMatrix = static_cast<CoglMatrix*>(g_value_get_boxed(toValue)); 92 93 ASSERT(fromCoglMatrix && toCoglMatrix); 94 95 TransformationMatrix fromMatrix(fromCoglMatrix); 96 TransformationMatrix toMatrix(toCoglMatrix); 97 toMatrix.blend(fromMatrix, progress); 98 99 CoglMatrix resultCoglMatrix = toMatrix; 100 g_value_set_boxed(returnValue, &resultCoglMatrix); 101 102 return true; 103 } 104 88 105 PlatformClutterAnimation::AnimatedPropertyType PlatformClutterAnimation::stringToAnimatedPropertyType(const String& keyPath) const 89 106 { … … 136 153 } 137 154 155 bool PlatformClutterAnimation::supportsAdditiveValueFunction() 156 { 157 // FIXME: Clutter 1.12 doesn't support additive valueFunction type animations. 158 // So, we use matrix animation instead until clutter supports it. 159 return false; 160 } 161 138 162 double PlatformClutterAnimation::beginTime() const 139 163 { … … 278 302 void PlatformClutterAnimation::setFromValue(const WebCore::TransformationMatrix& value) 279 303 { 280 notImplemented(); 304 if (animationType() != Basic || m_fromValueMatrix == value) 305 return; 306 307 m_fromValueMatrix = value; 281 308 } 282 309 … … 309 336 void PlatformClutterAnimation::setToValue(const WebCore::TransformationMatrix& value) 310 337 { 311 notImplemented(); 338 if (animationType() != Basic || m_toValueMatrix == value) 339 return; 340 341 m_toValueMatrix = value; 312 342 } 313 343 … … 413 443 414 444 clutter_transition_group_add_transition(CLUTTER_TRANSITION_GROUP(m_animation.get()), transition.get()); 445 } 446 447 void PlatformClutterAnimation::addClutterTransitionForProperty(const String& property, const WebCore::TransformationMatrix& fromValue, const WebCore::TransformationMatrix& toValue) 448 { 449 ASSERT(property != "NoProperty"); 450 451 const CoglMatrix fromCoglMatrix = fromValue; 452 const CoglMatrix toCoglMatrix = toValue; 453 454 GRefPtr<ClutterTransition> transition = adoptGRef(clutter_property_transition_new(property.utf8().data())); 455 clutter_transition_set_from(transition.get(), CLUTTER_TYPE_MATRIX, &fromCoglMatrix); 456 clutter_transition_set_to(transition.get(), CLUTTER_TYPE_MATRIX, &toCoglMatrix); 457 458 clutter_timeline_set_progress_mode(timeline(), toClutterAnimationMode(m_timingFunction)); 459 460 clutter_transition_group_add_transition(CLUTTER_TRANSITION_GROUP(m_animation.get()), transition.get()); 461 462 // FIXME: The matrix interpolation api, clutter_matrix_progress of Clutter 1.12 works unexpectedly. 463 // So we overwrite it and handle the interpolation of two matrices with TransformationMatrix. 464 // See https://bugzilla.gnome.org/show_bug.cgi?id=694197 465 clutter_interval_register_progress_func(CLUTTER_TYPE_MATRIX, clutterMatrixProgress); 415 466 } 416 467 … … 546 597 addClutterTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_fromValue3D, m_toValue3D); 547 598 break; 599 case Matrix: 600 addClutterTransitionForProperty(toClutterActorPropertyString(m_valueFunctionType), m_fromValueMatrix, m_toValueMatrix); 601 break; 548 602 default: 549 603 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/platform/graphics/clutter/PlatformClutterAnimation.h
r143343 r143369 56 56 enum AnimatedPropertyType { NoAnimatedPropertyType, Transform, Opacity, BackgroundColor }; 57 57 enum FillModeType { NoFillMode, Forwards, Backwards, Both }; 58 enum ValueFunctionType { NoValueFunction, RotateX, RotateY, RotateZ, ScaleX, ScaleY, ScaleZ, Scale, TranslateX, TranslateY, TranslateZ, Translate };58 enum ValueFunctionType { NoValueFunction, RotateX, RotateY, RotateZ, ScaleX, ScaleY, ScaleZ, Scale, TranslateX, TranslateY, TranslateZ, Translate, Matrix }; 59 59 60 60 static PassRefPtr<PlatformClutterAnimation> create(AnimationType, const String& keyPath); … … 64 64 65 65 static bool supportsValueFunction(); 66 static bool supportsAdditiveValueFunction(); 66 67 67 68 AnimationType animationType() const { return m_type; } … … 140 141 141 142 void addClutterTransitionForProperty(const String& property, const float fromValue, const float toValue); 143 void addClutterTransitionForProperty(const String& property, const WebCore::TransformationMatrix&, const WebCore::TransformationMatrix&); 142 144 void addClutterTransitionForProperty(const String& property, const FloatPoint3D& fromValue, const FloatPoint3D& toValue); 143 145 … … 162 164 FloatPoint3D m_toValue3D; 163 165 166 WebCore::TransformationMatrix m_fromValueMatrix; 167 WebCore::TransformationMatrix m_toValueMatrix; 168 164 169 float m_repeatCount; 165 170 -
trunk/Source/WebCore/platform/graphics/clutter/TransformationMatrixClutter.cpp
r129387 r143369 52 52 } 53 53 54 TransformationMatrix::TransformationMatrix(const CoglMatrix* matrix) 55 { 56 setMatrix(matrix->xx, matrix->yx, matrix->zx, matrix->wx, 57 matrix->xy, matrix->yy, matrix->zy, matrix->wy, 58 matrix->xz, matrix->yz, matrix->zz, matrix->wz, 59 matrix->xw, matrix->yw, matrix->zw, matrix->ww); 54 60 } 61 62 } -
trunk/Source/WebCore/platform/graphics/transforms/TransformationMatrix.h
r140455 r143369 342 342 #endif 343 343 #if USE(CLUTTER) 344 TransformationMatrix(const CoglMatrix*); 344 345 operator CoglMatrix() const; 345 346 #endif
Note: See TracChangeset
for help on using the changeset viewer.