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

Unified Diff: ui/aura/desktop.cc

Issue 8400059: Revert 107715 - Enable the new layer animation framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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
« no previous file with comments | « ui/aura/desktop.h ('k') | ui/aura/screen_rotation.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/desktop.cc
===================================================================
--- ui/aura/desktop.cc (revision 107719)
+++ ui/aura/desktop.cc (working copy)
@@ -21,15 +21,11 @@
#include "ui/aura/event_filter.h"
#include "ui/aura/focus_manager.h"
#include "ui/aura/screen_aura.h"
-#include "ui/aura/screen_rotation.h"
#include "ui/aura/toplevel_window_container.h"
#include "ui/aura/window.h"
#include "ui/aura/window_delegate.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/layer.h"
-#include "ui/gfx/compositor/layer_animation_sequence.h"
-#include "ui/gfx/compositor/layer_animator.h"
-#include "ui/gfx/interpolated_transform.h"
using std::string;
using std::vector;
@@ -44,22 +40,6 @@
static const int kDefaultHostWindowWidth = 1280;
static const int kDefaultHostWindowHeight = 1024;
-#if !defined(NDEBUG)
-// Converts degrees to an angle in the range [-180, 180).
-int NormalizeAngle(int degrees) {
- while (degrees <= -180) degrees += 360;
- while (degrees > 180) degrees -= 360;
- return degrees;
-}
-
-static int SymmetricRound(float x) {
- return static_cast<int>(
- x > 0
- ? std::floor(x + 0.5f)
- : std::ceil(x - 0.5f));
-}
-#endif
-
class DefaultDesktopDelegate : public DesktopDelegate {
public:
explicit DefaultDesktopDelegate(Desktop* desktop) : desktop_(desktop) {}
@@ -279,37 +259,31 @@
bool Desktop::DispatchKeyEvent(KeyEvent* event) {
#if !defined(NDEBUG)
+ // Press Home key to rotate the screen. Primarily used for testing.
if (event->type() == ui::ET_KEY_PRESSED &&
- (event->flags() & ui::EF_SHIFT_DOWN) &&
- (event->flags() & ui::EF_ALT_DOWN) &&
- event->is_char()) {
-
- bool should_rotate = true;
- int new_degrees = 0;
- switch (event->key_code()) {
- case ui::VKEY_UP: new_degrees = 0; break;
- case ui::VKEY_DOWN: new_degrees = 180; break;
- case ui::VKEY_RIGHT: new_degrees = 90; break;
- case ui::VKEY_LEFT: new_degrees = -90; break;
- default: should_rotate = false; break;
+ (event->flags() & ui::EF_CONTROL_DOWN) &&
+ event->key_code() == ui::VKEY_HOME) {
+ ui::Transform transform;
+ static int count = 0;
+ gfx::Size size = host_->GetSize();
+ switch (count) {
+ case 0:
+ transform.ConcatRotate(-90.0f);
+ transform.ConcatTranslate(0, size.height());
+ break;
+ case 1:
+ transform.ConcatRotate(180.0f);
+ transform.ConcatTranslate(size.width(), size.height());
+ break;
+ case 2:
+ transform.ConcatRotate(90.0f);
+ transform.ConcatTranslate(size.width(), 0);
+ break;
}
-
- if (should_rotate) {
- float rotation = 0.0f;
- int degrees = 0;
- const ui::Transform& transform = layer()->GetTargetTransform();
- if (ui::InterpolatedTransform::FactorTRS(transform,
- NULL, &rotation, NULL))
- degrees = NormalizeAngle(new_degrees - SymmetricRound(rotation));
-
- if (degrees != 0) {
- layer()->GetAnimator()->set_preemption_strategy(
- ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS);
- layer()->GetAnimator()->ScheduleAnimationElement(
- new ScreenRotation(degrees));
- return true;
- }
- }
+ layer()->SetAnimation(CreateDefaultAnimation());
+ SetTransform(transform);
+ count = (count + 1) % 4;
+ return true;
}
#endif
@@ -468,7 +442,7 @@
// If the layer is not animating, then we need to update the host size
// immediately.
- if (!layer()->GetAnimator()->is_animating())
+ if (!layer()->has_animation())
OnHostResized(host_->GetSize());
}
@@ -557,8 +531,7 @@
return this;
}
-void Desktop::OnLayerAnimationEnded(
- const ui::LayerAnimationSequence* animation) {
+void Desktop::OnLayerAnimationEnded(const ui::Animation* animation) {
OnHostResized(host_->GetSize());
}
« no previous file with comments | « ui/aura/desktop.h ('k') | ui/aura/screen_rotation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698