| 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" | |
| 9 #include "third_party/skia/include/core/SkPath.h" | 8 #include "third_party/skia/include/core/SkPath.h" |
| 10 #include "third_party/skia/include/core/SkRect.h" | 9 #include "third_party/skia/include/core/SkRect.h" |
| 11 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
| 12 #include "ui/compositor/layer.h" | 11 #include "ui/compositor/layer.h" |
| 13 #include "ui/gfx/canvas.h" | 12 #include "ui/gfx/canvas.h" |
| 14 #include "ui/gfx/transform.h" | 13 #include "ui/gfx/transform.h" |
| 15 #include "ui/views/view.h" | 14 #include "ui/views/view.h" |
| 16 | 15 |
| 17 namespace ash { | 16 namespace ash { |
| 18 namespace { | 17 namespace { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 39 // completes at the end of the animation. | 38 // completes at the end of the animation. |
| 40 const int kAutoclickRingAngleEndValue = 360; | 39 const int kAutoclickRingAngleEndValue = 360; |
| 41 | 40 |
| 42 // Visual constants. | 41 // Visual constants. |
| 43 const SkColor kAutoclickRingArcColor = SkColorSetARGB(255, 0, 255, 0); | 42 const SkColor kAutoclickRingArcColor = SkColorSetARGB(255, 0, 255, 0); |
| 44 const SkColor kAutoclickRingCircleColor = SkColorSetARGB(255, 0, 0, 255); | 43 const SkColor kAutoclickRingCircleColor = SkColorSetARGB(255, 0, 0, 255); |
| 45 | 44 |
| 46 void PaintAutoclickRingCircle(gfx::Canvas* canvas, | 45 void PaintAutoclickRingCircle(gfx::Canvas* canvas, |
| 47 gfx::Point& center, | 46 gfx::Point& center, |
| 48 int radius) { | 47 int radius) { |
| 49 SkPaint paint; | 48 cc::PaintFlags paint; |
| 50 paint.setStyle(SkPaint::kStroke_Style); | 49 paint.setStyle(cc::PaintFlags::kStroke_Style); |
| 51 paint.setStrokeWidth(2 * kAutoclickRingArcWidth); | 50 paint.setStrokeWidth(2 * kAutoclickRingArcWidth); |
| 52 paint.setColor(kAutoclickRingCircleColor); | 51 paint.setColor(kAutoclickRingCircleColor); |
| 53 paint.setAntiAlias(true); | 52 paint.setAntiAlias(true); |
| 54 | 53 |
| 55 canvas->DrawCircle(center, radius, paint); | 54 canvas->DrawCircle(center, radius, paint); |
| 56 } | 55 } |
| 57 | 56 |
| 58 void PaintAutoclickRingArc(gfx::Canvas* canvas, | 57 void PaintAutoclickRingArc(gfx::Canvas* canvas, |
| 59 const gfx::Point& center, | 58 const gfx::Point& center, |
| 60 int radius, | 59 int radius, |
| 61 int start_angle, | 60 int start_angle, |
| 62 int end_angle) { | 61 int end_angle) { |
| 63 SkPaint paint; | 62 cc::PaintFlags paint; |
| 64 paint.setStyle(SkPaint::kStroke_Style); | 63 paint.setStyle(cc::PaintFlags::kStroke_Style); |
| 65 paint.setStrokeWidth(2 * kAutoclickRingArcWidth); | 64 paint.setStrokeWidth(2 * kAutoclickRingArcWidth); |
| 66 paint.setColor(kAutoclickRingArcColor); | 65 paint.setColor(kAutoclickRingArcColor); |
| 67 paint.setAntiAlias(true); | 66 paint.setAntiAlias(true); |
| 68 | 67 |
| 69 SkPath arc_path; | 68 SkPath arc_path; |
| 70 arc_path.addArc(SkRect::MakeXYWH(center.x() - radius, center.y() - radius, | 69 arc_path.addArc(SkRect::MakeXYWH(center.x() - radius, center.y() - radius, |
| 71 2 * radius, 2 * radius), | 70 2 * radius, 2 * radius), |
| 72 start_angle, end_angle - start_angle); | 71 start_angle, end_angle - start_angle); |
| 73 canvas->DrawPath(arc_path, paint); | 72 canvas->DrawPath(arc_path, paint); |
| 74 } | 73 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 current_animation_type_ = AnimationType::NONE; | 256 current_animation_type_ = AnimationType::NONE; |
| 258 break; | 257 break; |
| 259 case AnimationType::NONE: | 258 case AnimationType::NONE: |
| 260 // fall through to reset the view. | 259 // fall through to reset the view. |
| 261 view_.reset(); | 260 view_.reset(); |
| 262 break; | 261 break; |
| 263 } | 262 } |
| 264 } | 263 } |
| 265 | 264 |
| 266 } // namespace ash | 265 } // namespace ash |
| OLD | NEW |