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

Unified Diff: chrome/browser/ui/touch/animation/screen_rotation.cc

Issue 8362006: Reland r107720 - Enable the new layer animation framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with parent patch Created 9 years, 2 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: chrome/browser/ui/touch/animation/screen_rotation.cc
diff --git a/chrome/browser/ui/touch/animation/screen_rotation.cc b/chrome/browser/ui/touch/animation/screen_rotation.cc
index 2307461e3293f2a973907440acc668b020dc64b8..81ebbcfb47abf1aafcbc402a5bd23714aa68287e 100644
--- a/chrome/browser/ui/touch/animation/screen_rotation.cc
+++ b/chrome/browser/ui/touch/animation/screen_rotation.cc
@@ -9,6 +9,7 @@
#include "base/task.h"
#include "ui/base/animation/slide_animation.h"
#include "ui/gfx/compositor/layer.h"
+#include "ui/gfx/compositor/layer_animation_delegate.h"
#include "ui/gfx/interpolated_transform.h"
#include "ui/gfx/rect.h"
#include "ui/gfx/transform.h"
@@ -18,7 +19,6 @@
namespace {
const int kDefaultTransitionDurationMs = 350;
-
} // namespace
////////////////////////////////////////////////////////////////////////////////
@@ -33,10 +33,12 @@ ScreenRotationListener::~ScreenRotationListener() {
//
ScreenRotation::ScreenRotation(views::View* view,
+ ui::LayerAnimationDelegate* delegate,
ScreenRotationListener* listener,
float old_degrees,
float new_degrees)
: view_(view),
+ delegate_(delegate),
widget_(view->GetWidget()),
listener_(listener),
old_degrees_(old_degrees),
@@ -65,15 +67,15 @@ ScreenRotation::~ScreenRotation() {
void ScreenRotation::Stop() {
animation_.reset();
- if (view_->layer()) {
+ if (delegate_) {
if (!interpolated_transform_.get()) {
// attempt to initialize.
Init();
}
if (interpolated_transform_.get()) {
- view_->layer()->SetTransform(interpolated_transform_->Interpolate(1.0));
- view_->GetWidget()->SchedulePaintInRect(
- view_->GetWidget()->GetClientAreaScreenBounds());
+ delegate_->SetTransformFromAnimation(
+ interpolated_transform_->Interpolate(1.0));
+ delegate_->ScheduleDrawForAnimation();
}
}
Finalize();
@@ -85,9 +87,9 @@ void ScreenRotation::Stop() {
void ScreenRotation::AnimationProgressed(const ui::Animation* anim) {
TRACE_EVENT0("ScreenRotation", "step");
- view_->layer()->SetTransform(interpolated_transform_->Interpolate(
- anim->GetCurrentValue()));
- widget_->SchedulePaintInRect(widget_->GetClientAreaScreenBounds());
+ delegate_->SetTransformFromAnimation(
+ interpolated_transform_->Interpolate(anim->GetCurrentValue()));
+ delegate_->ScheduleDrawForAnimation();
}
void ScreenRotation::AnimationEnded(const ui::Animation* anim) {
@@ -102,8 +104,8 @@ void ScreenRotation::AnimationEnded(const ui::Animation* anim) {
translation.SetTranslate(new_origin_.x() - origin.x(),
new_origin_.y() - origin.y());
xform.ConcatTransform(translation);
- view_->layer()->SetTransform(xform);
- widget_->SchedulePaintInRect(widget_->GetClientAreaScreenBounds());
+ delegate_->SetTransformFromAnimation(xform);
+ delegate_->ScheduleDrawForAnimation();
animation_stopped_ = true;
}
@@ -124,8 +126,9 @@ void ScreenRotation::Init() {
gfx::Point old_pivot;
gfx::Point new_pivot;
- int width = view_->layer()->bounds().width();
- int height = view_->layer()->bounds().height();
+ const gfx::Rect bounds = delegate_->GetBoundsForAnimation();
sky 2011/10/20 20:30:30 const gfx::Rect&
+ int width = bounds.width();
+ int height = bounds.height();
switch (degrees) {
case 90:

Powered by Google App Engine
This is Rietveld 408576698