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

Side by Side Diff: ash/wm/gestures/long_press_affordance_handler.cc

Issue 11269022: Add Vector2d classes that represent offsets, instead of using Point. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: RenderText fixup Created 8 years, 1 month 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 | Annotate | Revision Log
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/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
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(center.OffsetFromOrigin());
207 canvas->Transform(scale); 207 canvas->Transform(scale);
208 canvas->Translate(gfx::Point(-center.x(), -center.y())); 208 canvas->Translate(-center.OffsetFromOrigin());
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698