| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_focus_ring_layer.h" | 5 #include "chrome/browser/chromeos/ui/accessibility_focus_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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 AccessibilityFocusRingLayer::~AccessibilityFocusRingLayer() {} | 96 AccessibilityFocusRingLayer::~AccessibilityFocusRingLayer() {} |
| 97 | 97 |
| 98 void AccessibilityFocusRingLayer::Set(const AccessibilityFocusRing& ring) { | 98 void AccessibilityFocusRingLayer::Set(const AccessibilityFocusRing& ring) { |
| 99 ring_ = ring; | 99 ring_ = ring; |
| 100 | 100 |
| 101 gfx::Rect bounds = ring.GetBounds(); | 101 gfx::Rect bounds = ring.GetBounds(); |
| 102 int inset = kGradientWidth; | 102 int inset = kGradientWidth; |
| 103 bounds.Inset(-inset, -inset, -inset, -inset); | 103 bounds.Inset(-inset, -inset, -inset, -inset); |
| 104 | 104 |
| 105 gfx::Display display = | 105 gfx::Display display = gfx::Screen::GetScreen()->GetDisplayMatching(bounds); |
| 106 gfx::Screen::GetNativeScreen()->GetDisplayMatching(bounds); | |
| 107 aura::Window* root_window = ash::Shell::GetInstance() | 106 aura::Window* root_window = ash::Shell::GetInstance() |
| 108 ->window_tree_host_manager() | 107 ->window_tree_host_manager() |
| 109 ->GetRootWindowForDisplayId(display.id()); | 108 ->GetRootWindowForDisplayId(display.id()); |
| 110 CreateOrUpdateLayer(root_window, "AccessibilityFocusRing"); | 109 CreateOrUpdateLayer(root_window, "AccessibilityFocusRing"); |
| 111 | 110 |
| 112 // Update the layer bounds. | 111 // Update the layer bounds. |
| 113 layer()->SetBounds(bounds); | 112 layer()->SetBounds(bounds); |
| 114 } | 113 } |
| 115 | 114 |
| 116 void AccessibilityFocusRingLayer::OnPaintLayer( | 115 void AccessibilityFocusRingLayer::OnPaintLayer( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 129 paint.setColor( | 128 paint.setColor( |
| 130 SkColorSetARGBMacro( | 129 SkColorSetARGBMacro( |
| 131 255 * (w - i) * (w - i) / (w * w), | 130 255 * (w - i) * (w - i) / (w * w), |
| 132 kFocusRingColorRed, kFocusRingColorGreen, kFocusRingColorBlue)); | 131 kFocusRingColorRed, kFocusRingColorGreen, kFocusRingColorBlue)); |
| 133 path = MakePath(ring_, i, offset); | 132 path = MakePath(ring_, i, offset); |
| 134 recorder.canvas()->DrawPath(path, paint); | 133 recorder.canvas()->DrawPath(path, paint); |
| 135 } | 134 } |
| 136 } | 135 } |
| 137 | 136 |
| 138 } // namespace chromeos | 137 } // namespace chromeos |
| OLD | NEW |