| 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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 cc::PaintFlags flags; | 117 cc::PaintFlags flags; |
| 118 flags.setAntiAlias(true); | 118 flags.setAntiAlias(true); |
| 119 flags.setStyle(cc::PaintFlags::kStroke_Style); | 119 flags.setStyle(cc::PaintFlags::kStroke_Style); |
| 120 flags.setStrokeWidth(2); | 120 flags.setStrokeWidth(2); |
| 121 | 121 |
| 122 SkColor base_color = |
| 123 has_custom_color() |
| 124 ? custom_color() |
| 125 : SkColorSetARGBMacro(255, kFocusRingColorRed, kFocusRingColorGreen, |
| 126 kFocusRingColorBlue); |
| 127 |
| 122 SkPath path; | 128 SkPath path; |
| 123 gfx::Vector2d offset = layer()->bounds().OffsetFromOrigin(); | 129 gfx::Vector2d offset = layer()->bounds().OffsetFromOrigin(); |
| 124 const int w = kGradientWidth; | 130 const int w = kGradientWidth; |
| 125 for (int i = 0; i < w; ++i) { | 131 for (int i = 0; i < w; ++i) { |
| 126 flags.setColor(SkColorSetARGBMacro(255 * (w - i) * (w - i) / (w * w), | 132 flags.setColor(SkColorSetA(base_color, 255 * (w - i) * (w - i) / (w * w))); |
| 127 kFocusRingColorRed, kFocusRingColorGreen, | |
| 128 kFocusRingColorBlue)); | |
| 129 path = MakePath(ring_, i, offset); | 133 path = MakePath(ring_, i, offset); |
| 130 recorder.canvas()->DrawPath(path, flags); | 134 recorder.canvas()->DrawPath(path, flags); |
| 131 } | 135 } |
| 132 } | 136 } |
| 133 | 137 |
| 134 } // namespace chromeos | 138 } // namespace chromeos |
| OLD | NEW |