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/display/window_tree_host_manager.h" | 7 #include "ash/display/window_tree_host_manager.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "third_party/skia/include/core/SkPaint.h" | 10 #include "third_party/skia/include/core/SkPaint.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 | 38 |
39 AccessibilityCursorRingLayer::~AccessibilityCursorRingLayer() {} | 39 AccessibilityCursorRingLayer::~AccessibilityCursorRingLayer() {} |
40 | 40 |
41 void AccessibilityCursorRingLayer::Set(const gfx::Point& location) { | 41 void AccessibilityCursorRingLayer::Set(const gfx::Point& location) { |
42 location_ = location; | 42 location_ = location; |
43 | 43 |
44 gfx::Rect bounds = gfx::Rect(location.x(), location.y(), 0, 0); | 44 gfx::Rect bounds = gfx::Rect(location.x(), location.y(), 0, 0); |
45 int inset = kGradientWidth + kCursorRingRadius + kLayerMargin; | 45 int inset = kGradientWidth + kCursorRingRadius + kLayerMargin; |
46 bounds.Inset(-inset, -inset, -inset, -inset); | 46 bounds.Inset(-inset, -inset, -inset, -inset); |
47 | 47 |
48 gfx::Display display = gfx::Screen::GetScreen()->GetDisplayMatching(bounds); | 48 display::Display display = |
| 49 display::Screen::GetScreen()->GetDisplayMatching(bounds); |
49 aura::Window* root_window = ash::Shell::GetInstance() | 50 aura::Window* root_window = ash::Shell::GetInstance() |
50 ->window_tree_host_manager() | 51 ->window_tree_host_manager() |
51 ->GetRootWindowForDisplayId(display.id()); | 52 ->GetRootWindowForDisplayId(display.id()); |
52 CreateOrUpdateLayer(root_window, "AccessibilityCursorRing"); | 53 CreateOrUpdateLayer(root_window, "AccessibilityCursorRing"); |
53 | 54 |
54 // Update the layer bounds. | 55 // Update the layer bounds. |
55 layer()->SetBounds(bounds); | 56 layer()->SetBounds(bounds); |
56 } | 57 } |
57 | 58 |
58 void AccessibilityCursorRingLayer::SetOpacity(float opacity) { | 59 void AccessibilityCursorRingLayer::SetOpacity(float opacity) { |
(...skipping 17 matching lines...) Expand all Loading... |
76 paint.setColor( | 77 paint.setColor( |
77 SkColorSetARGBMacro(255 * (i) * (i) / (w * w), red_, green_, blue_)); | 78 SkColorSetARGBMacro(255 * (i) * (i) / (w * w), red_, green_, blue_)); |
78 SkPath path; | 79 SkPath path; |
79 path.addOval(SkRect::MakeXYWH(r.x(), r.y(), r.width(), r.height())); | 80 path.addOval(SkRect::MakeXYWH(r.x(), r.y(), r.width(), r.height())); |
80 r.Inset(1, 1, 1, 1); | 81 r.Inset(1, 1, 1, 1); |
81 recorder.canvas()->DrawPath(path, paint); | 82 recorder.canvas()->DrawPath(path, paint); |
82 } | 83 } |
83 } | 84 } |
84 | 85 |
85 } // namespace chromeos | 86 } // namespace chromeos |
OLD | NEW |