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

Side by Side Diff: ash/rotator/screen_rotation.cc

Issue 23724024: Refactor TransformPoint{,Reverse}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and resolve conflicts. Created 7 years, 3 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 unified diff | Download patch
« no previous file with comments | « ash/magnifier/magnification_controller.cc ('k') | ash/wm/window_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ash/rotator/screen_rotation.h" 5 #include "ash/rotator/screen_rotation.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "ui/compositor/layer.h" 8 #include "ui/compositor/layer.h"
9 #include "ui/gfx/interpolated_transform.h" 9 #include "ui/gfx/interpolated_transform.h"
10 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 new_origin_ = new_pivot = gfx::Point(0, height); 66 new_origin_ = new_pivot = gfx::Point(0, height);
67 break; 67 break;
68 case 180: 68 case 180:
69 case 360: 69 case 360:
70 new_pivot = old_pivot = gfx::Point(width / 2, height / 2); 70 new_pivot = old_pivot = gfx::Point(width / 2, height / 2);
71 new_origin_.SetPoint(width, height); 71 new_origin_.SetPoint(width, height);
72 break; 72 break;
73 } 73 }
74 74
75 // Convert points to world space. 75 // Convert points to world space.
76 current_transform.TransformPoint(old_pivot); 76 current_transform.TransformPoint(&old_pivot);
77 current_transform.TransformPoint(new_pivot); 77 current_transform.TransformPoint(&new_pivot);
78 current_transform.TransformPoint(new_origin_); 78 current_transform.TransformPoint(&new_origin_);
79 79
80 scoped_ptr<ui::InterpolatedTransform> rotation( 80 scoped_ptr<ui::InterpolatedTransform> rotation(
81 new ui::InterpolatedTransformAboutPivot( 81 new ui::InterpolatedTransformAboutPivot(
82 old_pivot, 82 old_pivot,
83 new ui::InterpolatedRotation(0, degrees_))); 83 new ui::InterpolatedRotation(0, degrees_)));
84 84
85 scoped_ptr<ui::InterpolatedTransform> translation( 85 scoped_ptr<ui::InterpolatedTransform> translation(
86 new ui::InterpolatedTranslation( 86 new ui::InterpolatedTranslation(
87 gfx::Point(0, 0), 87 gfx::Point(0, 0),
88 gfx::Point(new_pivot.x() - old_pivot.x(), 88 gfx::Point(new_pivot.x() - old_pivot.x(),
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // static 123 // static
124 const ui::LayerAnimationElement::AnimatableProperties& 124 const ui::LayerAnimationElement::AnimatableProperties&
125 ScreenRotation::GetProperties() { 125 ScreenRotation::GetProperties() {
126 static ui::LayerAnimationElement::AnimatableProperties properties; 126 static ui::LayerAnimationElement::AnimatableProperties properties;
127 if (properties.empty()) 127 if (properties.empty())
128 properties.insert(ui::LayerAnimationElement::TRANSFORM); 128 properties.insert(ui::LayerAnimationElement::TRANSFORM);
129 return properties; 129 return properties;
130 } 130 }
131 131
132 } // namespace ash 132 } // namespace ash
OLDNEW
« no previous file with comments | « ash/magnifier/magnification_controller.cc ('k') | ash/wm/window_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698