| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 aura::Window* root_window = ash::Shell::GetInstance() | 107 aura::Window* root_window = ash::Shell::GetInstance() |
| 108 ->window_tree_host_manager() | 108 ->window_tree_host_manager() |
| 109 ->GetRootWindowForDisplayId(display.id()); | 109 ->GetRootWindowForDisplayId(display.id()); |
| 110 CreateOrUpdateLayer(root_window, "AccessibilityFocusRing", bounds); | 110 CreateOrUpdateLayer(root_window, "AccessibilityFocusRing", bounds); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void AccessibilityFocusRingLayer::OnPaintLayer( | 113 void AccessibilityFocusRingLayer::OnPaintLayer( |
| 114 const ui::PaintContext& context) { | 114 const ui::PaintContext& context) { |
| 115 ui::PaintRecorder recorder(context, layer()->size()); | 115 ui::PaintRecorder recorder(context, layer()->size()); |
| 116 | 116 |
| 117 SkPaint paint; | 117 cc::PaintFlags flags; |
| 118 paint.setFlags(SkPaint::kAntiAlias_Flag); | 118 flags.setAntiAlias(true); |
| 119 paint.setStyle(SkPaint::kStroke_Style); | 119 flags.setStyle(cc::PaintFlags::kStroke_Style); |
| 120 paint.setStrokeWidth(2); | 120 flags.setStrokeWidth(2); |
| 121 | 121 |
| 122 SkPath path; | 122 SkPath path; |
| 123 gfx::Vector2d offset = layer()->bounds().OffsetFromOrigin(); | 123 gfx::Vector2d offset = layer()->bounds().OffsetFromOrigin(); |
| 124 const int w = kGradientWidth; | 124 const int w = kGradientWidth; |
| 125 for (int i = 0; i < w; ++i) { | 125 for (int i = 0; i < w; ++i) { |
| 126 paint.setColor( | 126 flags.setColor(SkColorSetARGBMacro(255 * (w - i) * (w - i) / (w * w), |
| 127 SkColorSetARGBMacro( | 127 kFocusRingColorRed, kFocusRingColorGreen, |
| 128 255 * (w - i) * (w - i) / (w * w), | 128 kFocusRingColorBlue)); |
| 129 kFocusRingColorRed, kFocusRingColorGreen, kFocusRingColorBlue)); | |
| 130 path = MakePath(ring_, i, offset); | 129 path = MakePath(ring_, i, offset); |
| 131 recorder.canvas()->DrawPath(path, paint); | 130 recorder.canvas()->DrawPath(path, flags); |
| 132 } | 131 } |
| 133 } | 132 } |
| 134 | 133 |
| 135 } // namespace chromeos | 134 } // namespace chromeos |
| OLD | NEW |