OLD | NEW |
---|---|
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/wm/gestures/long_press_affordance_handler.h" | 5 #include "ash/wm/gestures/long_press_affordance_handler.h" |
6 | 6 |
7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
196 } | 196 } |
197 | 197 |
198 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { | 198 virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE { |
199 gfx::Point center(GetPreferredSize().width() / 2, | 199 gfx::Point center(GetPreferredSize().width() / 2, |
200 GetPreferredSize().height() / 2); | 200 GetPreferredSize().height() / 2); |
201 canvas->Save(); | 201 canvas->Save(); |
202 | 202 |
203 gfx::Transform scale; | 203 gfx::Transform scale; |
204 scale.SetScale(current_scale_, current_scale_); | 204 scale.SetScale(current_scale_, current_scale_); |
205 // We want to scale from the center. | 205 // We want to scale from the center. |
206 canvas->Translate(gfx::Point(center.x(), center.y())); | 206 canvas->Translate(gfx::Vector2d(center.x(), center.y())); |
sky
2012/10/26 21:37:50
This too feels cumbersome. If we're saying a dista
Peter Kasting
2012/10/26 21:50:12
Seems like this should be:
canvas->Translate(ce
danakj
2012/10/26 21:59:43
Ya certainly, or just have
gfx::Vector2d centerOf
Peter Kasting
2012/10/26 22:04:06
The reason I didn't do this is because |center| is
| |
207 canvas->Transform(scale); | 207 canvas->Transform(scale); |
208 canvas->Translate(gfx::Point(-center.x(), -center.y())); | 208 canvas->Translate(gfx::Vector2d(-center.x(), -center.y())); |
209 | 209 |
210 // Paint affordance glow | 210 // Paint affordance glow |
211 int start_radius = kAffordanceInnerRadius - kAffordanceGlowWidth; | 211 int start_radius = kAffordanceInnerRadius - kAffordanceGlowWidth; |
212 int end_radius = kAffordanceOuterRadius + kAffordanceGlowWidth; | 212 int end_radius = kAffordanceOuterRadius + kAffordanceGlowWidth; |
213 const int num_colors = 3; | 213 const int num_colors = 3; |
214 SkScalar pos[num_colors] = {0, 0.5, 1}; | 214 SkScalar pos[num_colors] = {0, 0.5, 1}; |
215 SkColor colors[num_colors] = {kAffordanceGlowEndColor, | 215 SkColor colors[num_colors] = {kAffordanceGlowEndColor, |
216 kAffordanceGlowStartColor, kAffordanceGlowEndColor}; | 216 kAffordanceGlowStartColor, kAffordanceGlowEndColor}; |
217 PaintAffordanceGlow(canvas, center, start_radius, end_radius, colors, pos, | 217 PaintAffordanceGlow(canvas, center, start_radius, end_radius, colors, pos, |
218 num_colors); | 218 num_colors); |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
369 default: | 369 default: |
370 view_.reset(); | 370 view_.reset(); |
371 tap_down_touch_id_ = -1; | 371 tap_down_touch_id_ = -1; |
372 tap_down_display_id_ = 0; | 372 tap_down_display_id_ = 0; |
373 break; | 373 break; |
374 } | 374 } |
375 } | 375 } |
376 | 376 |
377 } // namespace internal | 377 } // namespace internal |
378 } // namespace ash | 378 } // namespace ash |
OLD | NEW |