OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/autoclick/common/autoclick_ring_handler.h" | 5 #include "ash/autoclick/common/autoclick_ring_handler.h" |
6 | 6 |
7 #include "third_party/skia/include/core/SkColor.h" | 7 #include "third_party/skia/include/core/SkColor.h" |
8 #include "third_party/skia/include/core/SkPaint.h" | 8 #include "third_party/skia/include/core/SkPaint.h" |
9 #include "third_party/skia/include/core/SkPath.h" | 9 #include "third_party/skia/include/core/SkPath.h" |
10 #include "third_party/skia/include/core/SkRect.h" | 10 #include "third_party/skia/include/core/SkRect.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 const double kAutoclickRingOpacityStartValue = 0.1; | 35 const double kAutoclickRingOpacityStartValue = 0.1; |
36 const double kAutoclickRingOpacityEndValue = 0.5; | 36 const double kAutoclickRingOpacityEndValue = 0.5; |
37 const int kAutoclickRingAngleStartValue = -90; | 37 const int kAutoclickRingAngleStartValue = -90; |
38 // The sweep angle is a bit greater than 360 to make sure the circle | 38 // The sweep angle is a bit greater than 360 to make sure the circle |
39 // completes at the end of the animation. | 39 // completes at the end of the animation. |
40 const int kAutoclickRingAngleEndValue = 360; | 40 const int kAutoclickRingAngleEndValue = 360; |
41 | 41 |
42 // Visual constants. | 42 // Visual constants. |
43 const SkColor kAutoclickRingArcColor = SkColorSetARGB(255, 0, 255, 0); | 43 const SkColor kAutoclickRingArcColor = SkColorSetARGB(255, 0, 255, 0); |
44 const SkColor kAutoclickRingCircleColor = SkColorSetARGB(255, 0, 0, 255); | 44 const SkColor kAutoclickRingCircleColor = SkColorSetARGB(255, 0, 0, 255); |
45 const int kAutoclickRingFrameRateHz = 60; | |
46 | 45 |
47 void PaintAutoclickRingCircle(gfx::Canvas* canvas, | 46 void PaintAutoclickRingCircle(gfx::Canvas* canvas, |
48 gfx::Point& center, | 47 gfx::Point& center, |
49 int radius) { | 48 int radius) { |
50 SkPaint paint; | 49 SkPaint paint; |
51 paint.setStyle(SkPaint::kStroke_Style); | 50 paint.setStyle(SkPaint::kStroke_Style); |
52 paint.setStrokeWidth(2 * kAutoclickRingArcWidth); | 51 paint.setStrokeWidth(2 * kAutoclickRingArcWidth); |
53 paint.setColor(kAutoclickRingCircleColor); | 52 paint.setColor(kAutoclickRingCircleColor); |
54 paint.setAntiAlias(true); | 53 paint.setAntiAlias(true); |
55 | 54 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 int current_angle_; | 160 int current_angle_; |
162 double current_scale_; | 161 double current_scale_; |
163 | 162 |
164 DISALLOW_COPY_AND_ASSIGN(AutoclickRingView); | 163 DISALLOW_COPY_AND_ASSIGN(AutoclickRingView); |
165 }; | 164 }; |
166 | 165 |
167 //////////////////////////////////////////////////////////////////////////////// | 166 //////////////////////////////////////////////////////////////////////////////// |
168 | 167 |
169 // AutoclickRingHandler, public | 168 // AutoclickRingHandler, public |
170 AutoclickRingHandler::AutoclickRingHandler() | 169 AutoclickRingHandler::AutoclickRingHandler() |
171 : gfx::LinearAnimation(kAutoclickRingFrameRateHz, nullptr), | 170 : gfx::LinearAnimation(nullptr), |
172 ring_widget_(nullptr), | 171 ring_widget_(nullptr), |
173 current_animation_type_(AnimationType::NONE) {} | 172 current_animation_type_(AnimationType::NONE) {} |
174 | 173 |
175 AutoclickRingHandler::~AutoclickRingHandler() { | 174 AutoclickRingHandler::~AutoclickRingHandler() { |
176 StopAutoclickRing(); | 175 StopAutoclickRing(); |
177 } | 176 } |
178 | 177 |
179 void AutoclickRingHandler::StartGesture( | 178 void AutoclickRingHandler::StartGesture( |
180 base::TimeDelta duration, | 179 base::TimeDelta duration, |
181 const gfx::Point& center_point_in_screen, | 180 const gfx::Point& center_point_in_screen, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 current_animation_type_ = AnimationType::NONE; | 257 current_animation_type_ = AnimationType::NONE; |
259 break; | 258 break; |
260 case AnimationType::NONE: | 259 case AnimationType::NONE: |
261 // fall through to reset the view. | 260 // fall through to reset the view. |
262 view_.reset(); | 261 view_.reset(); |
263 break; | 262 break; |
264 } | 263 } |
265 } | 264 } |
266 | 265 |
267 } // namespace ash | 266 } // namespace ash |
OLD | NEW |