Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(345)

Unified Diff: trunk/src/ui/compositor/layer_animation_element.cc

Issue 23809002: Revert 220479 "Add support for inverse transform animations." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: trunk/src/ui/compositor/layer_animation_element.cc
===================================================================
--- trunk/src/ui/compositor/layer_animation_element.cc (revision 220491)
+++ trunk/src/ui/compositor/layer_animation_element.cc (working copy)
@@ -394,10 +394,6 @@
}
protected:
- explicit ThreadedLayerAnimationElement(const LayerAnimationElement& element)
- : LayerAnimationElement(element) {
- }
-
virtual bool OnProgress(double t,
LayerAnimationDelegate* delegate) OVERRIDE {
if (t < 1.0)
@@ -567,117 +563,6 @@
DISALLOW_COPY_AND_ASSIGN(ThreadedTransformTransition);
};
-// InverseTransformTransision --------------------------------------------------
-
-class InverseTransformTransition : public ThreadedLayerAnimationElement {
- public:
- InverseTransformTransition(const gfx::Transform& base_transform,
- const LayerAnimationElement* uninverted_transition)
- : ThreadedLayerAnimationElement(*uninverted_transition),
- base_transform_(base_transform),
- uninverted_transition_(CheckAndCast(uninverted_transition)) {
- }
- virtual ~InverseTransformTransition() {}
-
- protected:
- virtual void OnStart(LayerAnimationDelegate* delegate) OVERRIDE {
- gfx::Transform start(delegate->GetTransformForAnimation());
- effective_start_ = base_transform_ * start;
-
- TargetValue target;
- uninverted_transition_->GetTargetValue(&target);
- base_target_ = target.transform;
-
- set_tween_type(uninverted_transition_->tween_type());
-
- float device_scale_factor = delegate->GetDeviceScaleFactor();
- const gfx::Transform cc_base_start = Layer::ConvertTransformToCCTransform(
- base_transform_,
- device_scale_factor);
- const gfx::Transform cc_base_target = Layer::ConvertTransformToCCTransform(
- base_target_,
- device_scale_factor);
- TransformAnimationCurveAdapter base_curve(tween_type(),
- cc_base_start,
- cc_base_target,
- duration());
-
- const gfx::Transform cc_start = Layer::ConvertTransformToCCTransform(
- start, device_scale_factor);
- animation_curve_.reset(new InverseTransformCurveAdapter(
- base_curve, cc_start, duration()));
- computed_target_transform_ = ComputeWithBaseTransform(effective_start_,
- base_target_);
- }
-
- virtual void OnAbort(LayerAnimationDelegate* delegate) OVERRIDE {
- if (delegate && Started()) {
- ThreadedLayerAnimationElement::OnAbort(delegate);
- delegate->SetTransformFromAnimation(ComputeCurrentTransform());
- }
- }
-
- virtual void OnEnd(LayerAnimationDelegate* delegate) OVERRIDE {
- delegate->SetTransformFromAnimation(computed_target_transform_);
- }
-
- virtual scoped_ptr<cc::Animation> CreateCCAnimation() OVERRIDE {
- scoped_ptr<cc::Animation> animation(
- cc::Animation::Create(animation_curve_->Clone(),
- animation_id(),
- animation_group_id(),
- cc::Animation::Transform));
- return animation.Pass();
- }
-
- virtual void OnGetTarget(TargetValue* target) const OVERRIDE {
- target->transform = computed_target_transform_;
- }
-
- private:
- gfx::Transform ComputeCurrentTransform() const {
- gfx::Transform base_current = Tween::ValueBetween(
- Tween::CalculateValue(tween_type(), last_progressed_fraction()),
- base_transform_,
- base_target_);
- return ComputeWithBaseTransform(effective_start_, base_current);
- }
-
- gfx::Transform ComputeWithBaseTransform(gfx::Transform start,
- gfx::Transform target) const {
- gfx::Transform to_return(gfx::Transform::kSkipInitialization);
- DCHECK(target.GetInverse(&to_return));
-
- to_return.PreconcatTransform(start);
- return to_return;
- }
-
- static AnimatableProperties GetProperties() {
- AnimatableProperties properties;
- properties.insert(LayerAnimationElement::TRANSFORM);
- return properties;
- }
-
- static const ThreadedTransformTransition* CheckAndCast(
- const LayerAnimationElement* element) {
- const AnimatableProperties& properties = element->properties();
- DCHECK(properties.find(TRANSFORM) != properties.end());
- return static_cast<const ThreadedTransformTransition*>(element);
- }
-
- gfx::Transform effective_start_;
- gfx::Transform computed_target_transform_;
-
- const gfx::Transform base_transform_;
- gfx::Transform base_target_;
-
- scoped_ptr<cc::AnimationCurve> animation_curve_;
-
- const ThreadedTransformTransition* const uninverted_transition_;
-
- DISALLOW_COPY_AND_ASSIGN(InverseTransformTransition);
-};
-
} // namespace
// LayerAnimationElement::TargetValue ------------------------------------------
@@ -716,17 +601,6 @@
last_progressed_fraction_(0.0) {
}
-LayerAnimationElement::LayerAnimationElement(
- const LayerAnimationElement &element)
- : first_frame_(element.first_frame_),
- properties_(element.properties_),
- duration_(element.duration_),
- tween_type_(element.tween_type_),
- animation_id_(cc::AnimationIdProvider::NextAnimationId()),
- animation_group_id_(element.animation_group_id_),
- last_progressed_fraction_(element.last_progressed_fraction_) {
-}
-
LayerAnimationElement::~LayerAnimationElement() {
}
@@ -855,13 +729,6 @@
}
// static
-LayerAnimationElement* LayerAnimationElement::CreateInverseTransformElement(
- const gfx::Transform& base_transform,
- const LayerAnimationElement* uninverted_transition) {
- return new InverseTransformTransition(base_transform, uninverted_transition);
-}
-
-// static
LayerAnimationElement*
LayerAnimationElement::CreateInterpolatedTransformElement(
InterpolatedTransform* interpolated_transform,
« no previous file with comments | « trunk/src/ui/compositor/layer_animation_element.h ('k') | trunk/src/ui/compositor/layer_animation_element_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698