diff options
author | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-27 05:51:20 +0000 |
---|---|---|
committer | jamescook@chromium.org <jamescook@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-27 05:51:20 +0000 |
commit | 8d2a9a32d0d09d09abf561bea48e97e436f84609 (patch) | |
tree | ac5e6cb24a9e0f05ba32ad735a0648982d909d11 /ash/rotator/screen_rotation.cc | |
parent | 4f0e111044e56a31274813aecd8ae1384e6a0a12 (diff) | |
download | chromium_src-8d2a9a32d0d09d09abf561bea48e97e436f84609.zip chromium_src-8d2a9a32d0d09d09abf561bea48e97e436f84609.tar.gz chromium_src-8d2a9a32d0d09d09abf561bea48e97e436f84609.tar.bz2 |
cros: Fix crash with screen rotation animation
Ensure the interpolated_transform_ member is initialized in the constructor
such that OnGetTarget() can be called before OnStart(). I added the animation
delegate to the constructor as we need it to initialize the transformation
matrix.
BUG=172328
TEST=manual, Ctrl-Alt-Shift-F3 should spin the windows and not crash
Review URL: https://chromiumcodereview.appspot.com/12087009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179082 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/rotator/screen_rotation.cc')
-rw-r--r-- | ash/rotator/screen_rotation.cc | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/ash/rotator/screen_rotation.cc b/ash/rotator/screen_rotation.cc index d4330a4..ecb45ef 100644 --- a/ash/rotator/screen_rotation.cc +++ b/ash/rotator/screen_rotation.cc @@ -31,19 +31,24 @@ base::TimeDelta GetTransitionDuration(int degrees) { } // namespace -ScreenRotation::ScreenRotation(int degrees) +ScreenRotation::ScreenRotation(int degrees, + ui::LayerAnimationDelegate* delegate) : ui::LayerAnimationElement(GetProperties(), GetTransitionDuration(degrees)), degrees_(degrees) { + InitTransform(delegate); } ScreenRotation::~ScreenRotation() { } -void ScreenRotation::OnStart(ui::LayerAnimationDelegate* delegate) { - // No rotation required. - if (degrees_ == 0) +void ScreenRotation::InitTransform(ui::LayerAnimationDelegate* delegate) { + // No rotation required, use the identity transform. + if (degrees_ == 0) { + interpolated_transform_.reset( + new ui::InterpolatedConstantTransform(gfx::Transform())); return; + } const gfx::Transform& current_transform = delegate->GetTransformForAnimation(); @@ -101,6 +106,9 @@ void ScreenRotation::OnStart(ui::LayerAnimationDelegate* delegate) { interpolated_transform_->SetChild(rotation.release()); } +void ScreenRotation::OnStart(ui::LayerAnimationDelegate* delegate) { +} + bool ScreenRotation::OnProgress(double t, ui::LayerAnimationDelegate* delegate) { delegate->SetTransformFromAnimation(interpolated_transform_->Interpolate(t)); |