| 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/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 9 #include "third_party/skia/include/core/SkRect.h" | 9 #include "third_party/skia/include/core/SkRect.h" |
| 10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 // completes at the end of the animation. | 38 // completes at the end of the animation. |
| 39 const int kAutoclickRingAngleEndValue = 360; | 39 const int kAutoclickRingAngleEndValue = 360; |
| 40 | 40 |
| 41 // Visual constants. | 41 // Visual constants. |
| 42 const SkColor kAutoclickRingArcColor = SkColorSetARGB(255, 0, 255, 0); | 42 const SkColor kAutoclickRingArcColor = SkColorSetARGB(255, 0, 255, 0); |
| 43 const SkColor kAutoclickRingCircleColor = SkColorSetARGB(255, 0, 0, 255); | 43 const SkColor kAutoclickRingCircleColor = SkColorSetARGB(255, 0, 0, 255); |
| 44 | 44 |
| 45 void PaintAutoclickRingCircle(gfx::Canvas* canvas, | 45 void PaintAutoclickRingCircle(gfx::Canvas* canvas, |
| 46 gfx::Point& center, | 46 gfx::Point& center, |
| 47 int radius) { | 47 int radius) { |
| 48 cc::PaintFlags paint; | 48 cc::PaintFlags flags; |
| 49 paint.setStyle(cc::PaintFlags::kStroke_Style); | 49 flags.setStyle(cc::PaintFlags::kStroke_Style); |
| 50 paint.setStrokeWidth(2 * kAutoclickRingArcWidth); | 50 flags.setStrokeWidth(2 * kAutoclickRingArcWidth); |
| 51 paint.setColor(kAutoclickRingCircleColor); | 51 flags.setColor(kAutoclickRingCircleColor); |
| 52 paint.setAntiAlias(true); | 52 flags.setAntiAlias(true); |
| 53 | 53 |
| 54 canvas->DrawCircle(center, radius, paint); | 54 canvas->DrawCircle(center, radius, flags); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void PaintAutoclickRingArc(gfx::Canvas* canvas, | 57 void PaintAutoclickRingArc(gfx::Canvas* canvas, |
| 58 const gfx::Point& center, | 58 const gfx::Point& center, |
| 59 int radius, | 59 int radius, |
| 60 int start_angle, | 60 int start_angle, |
| 61 int end_angle) { | 61 int end_angle) { |
| 62 cc::PaintFlags paint; | 62 cc::PaintFlags flags; |
| 63 paint.setStyle(cc::PaintFlags::kStroke_Style); | 63 flags.setStyle(cc::PaintFlags::kStroke_Style); |
| 64 paint.setStrokeWidth(2 * kAutoclickRingArcWidth); | 64 flags.setStrokeWidth(2 * kAutoclickRingArcWidth); |
| 65 paint.setColor(kAutoclickRingArcColor); | 65 flags.setColor(kAutoclickRingArcColor); |
| 66 paint.setAntiAlias(true); | 66 flags.setAntiAlias(true); |
| 67 | 67 |
| 68 SkPath arc_path; | 68 SkPath arc_path; |
| 69 arc_path.addArc(SkRect::MakeXYWH(center.x() - radius, center.y() - radius, | 69 arc_path.addArc(SkRect::MakeXYWH(center.x() - radius, center.y() - radius, |
| 70 2 * radius, 2 * radius), | 70 2 * radius, 2 * radius), |
| 71 start_angle, end_angle - start_angle); | 71 start_angle, end_angle - start_angle); |
| 72 canvas->DrawPath(arc_path, paint); | 72 canvas->DrawPath(arc_path, flags); |
| 73 } | 73 } |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 // View of the AutoclickRingHandler. Draws the actual contents and updates as | 76 // View of the AutoclickRingHandler. Draws the actual contents and updates as |
| 77 // the animation proceeds. It also maintains the views::Widget that the | 77 // the animation proceeds. It also maintains the views::Widget that the |
| 78 // animation is shown in. | 78 // animation is shown in. |
| 79 class AutoclickRingHandler::AutoclickRingView : public views::View { | 79 class AutoclickRingHandler::AutoclickRingView : public views::View { |
| 80 public: | 80 public: |
| 81 AutoclickRingView(const gfx::Point& event_location, | 81 AutoclickRingView(const gfx::Point& event_location, |
| 82 views::Widget* ring_widget) | 82 views::Widget* ring_widget) |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 current_animation_type_ = AnimationType::NONE; | 256 current_animation_type_ = AnimationType::NONE; |
| 257 break; | 257 break; |
| 258 case AnimationType::NONE: | 258 case AnimationType::NONE: |
| 259 // fall through to reset the view. | 259 // fall through to reset the view. |
| 260 view_.reset(); | 260 view_.reset(); |
| 261 break; | 261 break; |
| 262 } | 262 } |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace ash | 265 } // namespace ash |
| OLD | NEW |