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 "chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.h" | 5 #include "chrome/browser/chromeos/ui/accessibility_cursor_ring_layer.h" |
6 | 6 |
7 #include "ash/common/wm_window.h" | 7 #include "ash/common/wm_window.h" |
8 #include "ash/display/window_tree_host_manager.h" | 8 #include "ash/display/window_tree_host_manager.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 ->GetRootWindowForDisplayId(display.id()); | 53 ->GetRootWindowForDisplayId(display.id()); |
54 ash::WmWindow* root_wm_window = ash::WmWindow::Get(root_window); | 54 ash::WmWindow* root_wm_window = ash::WmWindow::Get(root_window); |
55 bounds = root_wm_window->ConvertRectFromScreen(bounds); | 55 bounds = root_wm_window->ConvertRectFromScreen(bounds); |
56 CreateOrUpdateLayer(root_window, "AccessibilityCursorRing", bounds); | 56 CreateOrUpdateLayer(root_window, "AccessibilityCursorRing", bounds); |
57 } | 57 } |
58 | 58 |
59 void AccessibilityCursorRingLayer::OnPaintLayer( | 59 void AccessibilityCursorRingLayer::OnPaintLayer( |
60 const ui::PaintContext& context) { | 60 const ui::PaintContext& context) { |
61 ui::PaintRecorder recorder(context, layer()->size()); | 61 ui::PaintRecorder recorder(context, layer()->size()); |
62 | 62 |
63 SkPaint paint; | 63 cc::PaintFlags flags; |
64 paint.setFlags(SkPaint::kAntiAlias_Flag); | 64 flags.setAntiAlias(true); |
65 paint.setStyle(SkPaint::kStroke_Style); | 65 flags.setStyle(cc::PaintFlags::kStroke_Style); |
66 paint.setStrokeWidth(2); | 66 flags.setStrokeWidth(2); |
67 | 67 |
68 gfx::Rect r = layer()->bounds(); | 68 gfx::Rect r = layer()->bounds(); |
69 r.Offset(-r.OffsetFromOrigin()); | 69 r.Offset(-r.OffsetFromOrigin()); |
70 r.Inset(kLayerMargin, kLayerMargin, kLayerMargin, kLayerMargin); | 70 r.Inset(kLayerMargin, kLayerMargin, kLayerMargin, kLayerMargin); |
71 const int w = kGradientWidth; | 71 const int w = kGradientWidth; |
72 for (int i = 0; i < w; ++i) { | 72 for (int i = 0; i < w; ++i) { |
73 paint.setColor( | 73 flags.setColor( |
74 SkColorSetARGBMacro(255 * (i) * (i) / (w * w), red_, green_, blue_)); | 74 SkColorSetARGBMacro(255 * (i) * (i) / (w * w), red_, green_, blue_)); |
75 SkPath path; | 75 SkPath path; |
76 path.addOval(SkRect::MakeXYWH(r.x(), r.y(), r.width(), r.height())); | 76 path.addOval(SkRect::MakeXYWH(r.x(), r.y(), r.width(), r.height())); |
77 r.Inset(1, 1, 1, 1); | 77 r.Inset(1, 1, 1, 1); |
78 recorder.canvas()->DrawPath(path, paint); | 78 recorder.canvas()->DrawPath(path, flags); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 } // namespace chromeos | 82 } // namespace chromeos |
OLD | NEW |