diff options
author | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-14 18:15:35 +0000 |
---|---|---|
committer | shawnsingh@chromium.org <shawnsingh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-14 18:15:35 +0000 |
commit | 0f0453e90e6a85e469e138f048d2c1ae9a80e561 (patch) | |
tree | e60da12bc146144f88dea794b5e45c6785c7169e /ui/compositor | |
parent | 4addcf3492db52c49f57d168d2bef07c46d411bd (diff) | |
download | chromium_src-0f0453e90e6a85e469e138f048d2c1ae9a80e561.zip chromium_src-0f0453e90e6a85e469e138f048d2c1ae9a80e561.tar.gz chromium_src-0f0453e90e6a85e469e138f048d2c1ae9a80e561.tar.bz2 |
Migrate ui::Transform to gfx::Transform
It is more appropriate for Transform class to belong with its fellow
geometry classes in the gfx namespace.
Review URL: https://chromiumcodereview.appspot.com/11145005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@161809 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/compositor')
-rw-r--r-- | ui/compositor/layer.cc | 20 | ||||
-rw-r--r-- | ui/compositor/layer.h | 17 | ||||
-rw-r--r-- | ui/compositor/layer_animation_delegate.h | 4 | ||||
-rw-r--r-- | ui/compositor/layer_animation_element.cc | 11 | ||||
-rw-r--r-- | ui/compositor/layer_animation_element.h | 5 | ||||
-rw-r--r-- | ui/compositor/layer_animation_element_unittest.cc | 2 | ||||
-rw-r--r-- | ui/compositor/layer_animation_sequence_unittest.cc | 2 | ||||
-rw-r--r-- | ui/compositor/layer_animator.cc | 4 | ||||
-rw-r--r-- | ui/compositor/layer_animator.h | 6 | ||||
-rw-r--r-- | ui/compositor/layer_unittest.cc | 2 | ||||
-rw-r--r-- | ui/compositor/test/test_layer_animation_delegate.cc | 5 | ||||
-rw-r--r-- | ui/compositor/test/test_layer_animation_delegate.h | 7 | ||||
-rw-r--r-- | ui/compositor/test/test_utils.cc | 3 | ||||
-rw-r--r-- | ui/compositor/test/test_utils.h | 6 |
14 files changed, 49 insertions, 45 deletions
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc index b658055..880648c 100644 --- a/ui/compositor/layer.cc +++ b/ui/compositor/layer.cc @@ -185,11 +185,11 @@ LayerAnimator* Layer::GetAnimator() { return animator_.get(); } -void Layer::SetTransform(const ui::Transform& transform) { +void Layer::SetTransform(const gfx::Transform& transform) { GetAnimator()->SetTransform(transform); } -Transform Layer::GetTargetTransform() const { +gfx::Transform Layer::GetTargetTransform() const { if (animator_.get() && animator_->IsAnimatingProperty( LayerAnimationElement::TRANSFORM)) { return animator_->GetTargetTransform(); @@ -559,7 +559,7 @@ void Layer::StackRelativeTo(Layer* child, Layer* other, bool above) { bool Layer::ConvertPointForAncestor(const Layer* ancestor, gfx::Point* point) const { - ui::Transform transform; + gfx::Transform transform; bool result = GetTransformRelativeTo(ancestor, &transform); gfx::Point3f p(*point); transform.TransformPoint(p); @@ -569,7 +569,7 @@ bool Layer::ConvertPointForAncestor(const Layer* ancestor, bool Layer::ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const { - ui::Transform transform; + gfx::Transform transform; bool result = GetTransformRelativeTo(ancestor, &transform); gfx::Point3f p(*point); transform.TransformPointReverse(p); @@ -578,7 +578,7 @@ bool Layer::ConvertPointFromAncestor(const Layer* ancestor, } bool Layer::GetTransformRelativeTo(const Layer* ancestor, - ui::Transform* transform) const { + gfx::Transform* transform) const { const Layer* p = this; for (; p && p != ancestor; p = p->parent()) { if (p->transform().HasChange()) @@ -615,7 +615,7 @@ void Layer::SetBoundsImmediately(const gfx::Rect& bounds) { } } -void Layer::SetTransformImmediately(const ui::Transform& transform) { +void Layer::SetTransformImmediately(const gfx::Transform& transform) { transform_ = transform; RecomputeTransform(); @@ -662,7 +662,7 @@ void Layer::SetBoundsFromAnimation(const gfx::Rect& bounds) { SetBoundsImmediately(bounds); } -void Layer::SetTransformFromAnimation(const Transform& transform) { +void Layer::SetTransformFromAnimation(const gfx::Transform& transform) { SetTransformImmediately(transform); } @@ -694,7 +694,7 @@ const gfx::Rect& Layer::GetBoundsForAnimation() const { return bounds(); } -const Transform& Layer::GetTransformForAnimation() const { +const gfx::Transform& Layer::GetTransformForAnimation() const { return transform(); } @@ -741,12 +741,12 @@ void Layer::CreateWebLayer() { } void Layer::RecomputeTransform() { - ui::Transform scale_translate; + gfx::Transform scale_translate; scale_translate.matrix().set3x3(device_scale_factor_, 0, 0, 0, device_scale_factor_, 0, 0, 0, 1); // Start with the inverse matrix of above. - Transform transform; + gfx::Transform transform; transform.matrix().set3x3(1.0f / device_scale_factor_, 0, 0, 0, 1.0f / device_scale_factor_, 0, 0, 0, 1); diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index 984bc39..58dfe0dc 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h @@ -108,12 +108,12 @@ class COMPOSITOR_EXPORT Layer LayerAnimator* GetAnimator(); // The transform, relative to the parent. - void SetTransform(const Transform& transform); - const Transform& transform() const { return transform_; } + void SetTransform(const gfx::Transform& transform); + const gfx::Transform& transform() const { return transform_; } // Return the target transform if animator is running, or the current // transform otherwise. - Transform GetTargetTransform() const; + gfx::Transform GetTargetTransform() const; // The bounds, relative to the parent. void SetBounds(const gfx::Rect& bounds); @@ -287,7 +287,7 @@ class COMPOSITOR_EXPORT Layer bool ConvertPointFromAncestor(const Layer* ancestor, gfx::Point* point) const; bool GetTransformRelativeTo(const Layer* ancestor, - Transform* transform) const; + gfx::Transform* transform) const; // The only externally updated layers are ones that get their pixels from // WebKit and WebKit does not produce valid alpha values. All other layers @@ -297,7 +297,7 @@ class COMPOSITOR_EXPORT Layer // Following are invoked from the animation or if no animation exists to // update the values immediately. void SetBoundsImmediately(const gfx::Rect& bounds); - void SetTransformImmediately(const ui::Transform& transform); + void SetTransformImmediately(const gfx::Transform& transform); void SetOpacityImmediately(float opacity); void SetVisibilityImmediately(bool visibility); void SetBrightnessImmediately(float brightness); @@ -306,7 +306,8 @@ class COMPOSITOR_EXPORT Layer // Implementation of LayerAnimatorDelegate virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; - virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE; + virtual void SetTransformFromAnimation( + const gfx::Transform& transform) OVERRIDE; virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; virtual void SetVisibilityFromAnimation(bool visibility) OVERRIDE; virtual void SetBrightnessFromAnimation(float brightness) OVERRIDE; @@ -314,7 +315,7 @@ class COMPOSITOR_EXPORT Layer virtual void SetColorFromAnimation(SkColor color) OVERRIDE; virtual void ScheduleDrawForAnimation() OVERRIDE; virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; - virtual const Transform& GetTransformForAnimation() const OVERRIDE; + virtual const gfx::Transform& GetTransformForAnimation() const OVERRIDE; virtual float GetOpacityForAnimation() const OVERRIDE; virtual bool GetVisibilityForAnimation() const OVERRIDE; virtual float GetBrightnessForAnimation() const OVERRIDE; @@ -340,7 +341,7 @@ class COMPOSITOR_EXPORT Layer // This layer's children, in bottom-to-top stacking order. std::vector<Layer*> children_; - ui::Transform transform_; + gfx::Transform transform_; gfx::Rect bounds_; diff --git a/ui/compositor/layer_animation_delegate.h b/ui/compositor/layer_animation_delegate.h index 0b61fa7..223eca2 100644 --- a/ui/compositor/layer_animation_delegate.h +++ b/ui/compositor/layer_animation_delegate.h @@ -16,7 +16,7 @@ namespace ui { class COMPOSITOR_EXPORT LayerAnimationDelegate { public: virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) = 0; - virtual void SetTransformFromAnimation(const Transform& transform) = 0; + virtual void SetTransformFromAnimation(const gfx::Transform& transform) = 0; virtual void SetOpacityFromAnimation(float opacity) = 0; virtual void SetVisibilityFromAnimation(bool visibility) = 0; virtual void SetBrightnessFromAnimation(float brightness) = 0; @@ -24,7 +24,7 @@ class COMPOSITOR_EXPORT LayerAnimationDelegate { virtual void SetColorFromAnimation(SkColor color) = 0; virtual void ScheduleDrawForAnimation() = 0; virtual const gfx::Rect& GetBoundsForAnimation() const = 0; - virtual const Transform& GetTransformForAnimation() const = 0; + virtual const gfx::Transform& GetTransformForAnimation() const = 0; virtual float GetOpacityForAnimation() const = 0; virtual bool GetVisibilityForAnimation() const = 0; virtual float GetBrightnessForAnimation() const = 0; diff --git a/ui/compositor/layer_animation_element.cc b/ui/compositor/layer_animation_element.cc index c48a81c..2b41e84 100644 --- a/ui/compositor/layer_animation_element.cc +++ b/ui/compositor/layer_animation_element.cc @@ -38,7 +38,7 @@ class Pause : public LayerAnimationElement { class TransformTransition : public LayerAnimationElement { public: - TransformTransition(const Transform& target, base::TimeDelta duration) + TransformTransition(const gfx::Transform& target, base::TimeDelta duration) : LayerAnimationElement(GetProperties(), duration), target_(target) { } @@ -68,8 +68,8 @@ class TransformTransition : public LayerAnimationElement { return properties; } - Transform start_; - const Transform target_; + gfx::Transform start_; + const gfx::Transform target_; DISALLOW_COPY_AND_ASSIGN(TransformTransition); }; @@ -382,7 +382,8 @@ LayerAnimationElement::TargetValue::TargetValue() LayerAnimationElement::TargetValue::TargetValue( const LayerAnimationDelegate* delegate) : bounds(delegate ? delegate->GetBoundsForAnimation() : gfx::Rect()), - transform(delegate ? delegate->GetTransformForAnimation() : Transform()), + transform(delegate ? + delegate->GetTransformForAnimation() : gfx::Transform()), opacity(delegate ? delegate->GetOpacityForAnimation() : 0.0f), visibility(delegate ? delegate->GetVisibilityForAnimation() : false), brightness(delegate ? delegate->GetBrightnessForAnimation() : 0.0f), @@ -436,7 +437,7 @@ base::TimeDelta LayerAnimationElement::GetEffectiveDuration( // static LayerAnimationElement* LayerAnimationElement::CreateTransformElement( - const Transform& transform, + const gfx::Transform& transform, base::TimeDelta duration) { return new TransformTransition(transform, duration); } diff --git a/ui/compositor/layer_animation_element.h b/ui/compositor/layer_animation_element.h index 870f005..46aedb7 100644 --- a/ui/compositor/layer_animation_element.h +++ b/ui/compositor/layer_animation_element.h @@ -18,7 +18,6 @@ namespace ui { class InterpolatedTransform; class LayerAnimationDelegate; -class Transform; // LayerAnimationElements represent one segment of an animation between two // keyframes. They know how to update a LayerAnimationDelegate given a value @@ -41,7 +40,7 @@ class COMPOSITOR_EXPORT LayerAnimationElement { explicit TargetValue(const LayerAnimationDelegate* delegate); gfx::Rect bounds; - Transform transform; + gfx::Transform transform; float opacity; bool visibility; float brightness; @@ -58,7 +57,7 @@ class COMPOSITOR_EXPORT LayerAnimationElement { // Creates an element that transitions to the given transform. The caller owns // the return value. static LayerAnimationElement* CreateTransformElement( - const Transform& transform, + const gfx::Transform& transform, base::TimeDelta duration); // Creates an element that transitions to another in a way determined by an diff --git a/ui/compositor/layer_animation_element_unittest.cc b/ui/compositor/layer_animation_element_unittest.cc index ca6433e..fae15e0 100644 --- a/ui/compositor/layer_animation_element_unittest.cc +++ b/ui/compositor/layer_animation_element_unittest.cc @@ -23,7 +23,7 @@ namespace { // that the element can be reused after it completes. TEST(LayerAnimationElementTest, TransformElement) { TestLayerAnimationDelegate delegate; - Transform start_transform, target_transform, middle_transform; + gfx::Transform start_transform, target_transform, middle_transform; start_transform.SetRotate(-90); target_transform.SetRotate(90); base::TimeDelta delta = base::TimeDelta::FromSeconds(1); diff --git a/ui/compositor/layer_animation_sequence_unittest.cc b/ui/compositor/layer_animation_sequence_unittest.cc index fa31967..f8db16e 100644 --- a/ui/compositor/layer_animation_sequence_unittest.cc +++ b/ui/compositor/layer_animation_sequence_unittest.cc @@ -77,7 +77,7 @@ TEST(LayerAnimationSequenceTest, MultipleElement) { sequence.AddElement( LayerAnimationElement::CreatePauseElement(properties, delta)); - Transform start_transform, target_transform, middle_transform; + gfx::Transform start_transform, target_transform, middle_transform; start_transform.SetRotate(-90); target_transform.SetRotate(90); diff --git a/ui/compositor/layer_animator.cc b/ui/compositor/layer_animator.cc index 0524586..90825518 100644 --- a/ui/compositor/layer_animator.cc +++ b/ui/compositor/layer_animator.cc @@ -73,7 +73,7 @@ LayerAnimator* LayerAnimator::CreateImplicitAnimator() { return new LayerAnimator(kDefaultTransitionDuration); } -void LayerAnimator::SetTransform(const Transform& transform) { +void LayerAnimator::SetTransform(const gfx::Transform& transform) { base::TimeDelta duration = GetTransitionDuration(); scoped_ptr<LayerAnimationElement> element( LayerAnimationElement::CreateTransformElement(transform, duration)); @@ -81,7 +81,7 @@ void LayerAnimator::SetTransform(const Transform& transform) { StartAnimation(new LayerAnimationSequence(element.release())); } -Transform LayerAnimator::GetTargetTransform() const { +gfx::Transform LayerAnimator::GetTargetTransform() const { LayerAnimationElement::TargetValue target(delegate()); GetTargetValue(&target); return target.transform; diff --git a/ui/compositor/layer_animator.h b/ui/compositor/layer_animator.h index 783d6cb..d96badd 100644 --- a/ui/compositor/layer_animator.h +++ b/ui/compositor/layer_animator.h @@ -20,6 +20,7 @@ namespace gfx { class Rect; +class Transform; } namespace ui { @@ -29,7 +30,6 @@ class LayerAnimationSequence; class LayerAnimationDelegate; class LayerAnimationObserver; class ScopedLayerAnimationSettings; -class Transform; // When a property of layer needs to be changed it is set by way of // LayerAnimator. This enables LayerAnimator to animate property changes. @@ -60,8 +60,8 @@ class COMPOSITOR_EXPORT LayerAnimator static LayerAnimator* CreateImplicitAnimator(); // Sets the transform on the delegate. May cause an implicit animation. - virtual void SetTransform(const Transform& transform); - Transform GetTargetTransform() const; + virtual void SetTransform(const gfx::Transform& transform); + gfx::Transform GetTargetTransform() const; // Sets the bounds on the delegate. May cause an implicit animation. virtual void SetBounds(const gfx::Rect& bounds); diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc index ef161a7..f246997 100644 --- a/ui/compositor/layer_unittest.cc +++ b/ui/compositor/layer_unittest.cc @@ -909,7 +909,7 @@ TEST_F(LayerWithRealCompositorTest, MAYBE_CompositorObservers) { // Setting the transform of a layer should alert the observers. observer.Reset(); - Transform transform; + gfx::Transform transform; transform.ConcatTranslate(-200, -200); transform.ConcatRotate(90.0f); transform.ConcatTranslate(200, 200); diff --git a/ui/compositor/test/test_layer_animation_delegate.cc b/ui/compositor/test/test_layer_animation_delegate.cc index f5e9262..a3d7f67 100644 --- a/ui/compositor/test/test_layer_animation_delegate.cc +++ b/ui/compositor/test/test_layer_animation_delegate.cc @@ -32,7 +32,7 @@ void TestLayerAnimationDelegate::SetBoundsFromAnimation( } void TestLayerAnimationDelegate::SetTransformFromAnimation( - const Transform& transform) { + const gfx::Transform& transform) { transform_ = transform; } @@ -63,7 +63,8 @@ const gfx::Rect& TestLayerAnimationDelegate::GetBoundsForAnimation() const { return bounds_; } -const Transform& TestLayerAnimationDelegate::GetTransformForAnimation() const { +const gfx::Transform& +TestLayerAnimationDelegate::GetTransformForAnimation() const { return transform_; } diff --git a/ui/compositor/test/test_layer_animation_delegate.h b/ui/compositor/test/test_layer_animation_delegate.h index e492d4a..2c21aa5 100644 --- a/ui/compositor/test/test_layer_animation_delegate.h +++ b/ui/compositor/test/test_layer_animation_delegate.h @@ -20,7 +20,8 @@ class TestLayerAnimationDelegate : public LayerAnimationDelegate { // Implementation of LayerAnimationDelegate virtual void SetBoundsFromAnimation(const gfx::Rect& bounds) OVERRIDE; - virtual void SetTransformFromAnimation(const Transform& transform) OVERRIDE; + virtual void SetTransformFromAnimation( + const gfx::Transform& transform) OVERRIDE; virtual void SetOpacityFromAnimation(float opacity) OVERRIDE; virtual void SetVisibilityFromAnimation(bool visibility) OVERRIDE; virtual void SetBrightnessFromAnimation(float brightness) OVERRIDE; @@ -28,7 +29,7 @@ class TestLayerAnimationDelegate : public LayerAnimationDelegate { virtual void SetColorFromAnimation(SkColor color) OVERRIDE; virtual void ScheduleDrawForAnimation() OVERRIDE; virtual const gfx::Rect& GetBoundsForAnimation() const OVERRIDE; - virtual const Transform& GetTransformForAnimation() const OVERRIDE; + virtual const gfx::Transform& GetTransformForAnimation() const OVERRIDE; virtual float GetOpacityForAnimation() const OVERRIDE; virtual bool GetVisibilityForAnimation() const OVERRIDE; virtual float GetBrightnessForAnimation() const OVERRIDE; @@ -37,7 +38,7 @@ class TestLayerAnimationDelegate : public LayerAnimationDelegate { private: gfx::Rect bounds_; - Transform transform_; + gfx::Transform transform_; float opacity_; bool visibility_; float brightness_; diff --git a/ui/compositor/test/test_utils.cc b/ui/compositor/test/test_utils.cc index 43f7f02..dc70b79 100644 --- a/ui/compositor/test/test_utils.cc +++ b/ui/compositor/test/test_utils.cc @@ -10,7 +10,8 @@ namespace ui { -void CheckApproximatelyEqual(const Transform& lhs, const Transform& rhs) { +void CheckApproximatelyEqual(const gfx::Transform& lhs, + const gfx::Transform& rhs) { for (int i = 0; i < 4; ++i) { for (int j = 0; j < 4; ++j) { EXPECT_FLOAT_EQ(lhs.matrix().get(i, j), rhs.matrix().get(i, j)); diff --git a/ui/compositor/test/test_utils.h b/ui/compositor/test/test_utils.h index 3364ba3..9f2163b 100644 --- a/ui/compositor/test/test_utils.h +++ b/ui/compositor/test/test_utils.h @@ -7,13 +7,13 @@ namespace gfx { class Rect; +class Transform; } namespace ui { -class Transform; - -void CheckApproximatelyEqual(const Transform& lhs, const Transform& rhs); +void CheckApproximatelyEqual(const gfx::Transform& lhs, + const gfx::Transform& rhs); void CheckApproximatelyEqual(const gfx::Rect& lhs, const gfx::Rect& rhs); } // namespace ui |