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/display_controller.h" | 7 #include "ash/display/display_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 | 34 |
35 for (int i = 0; i < 36; i++) { | 35 for (int i = 0; i < 36; i++) { |
36 gfx::Point p = input_ring.points[i]; | 36 gfx::Point p = input_ring.points[i]; |
37 gfx::Point prev; | 37 gfx::Point prev; |
38 gfx::Point next; | 38 gfx::Point next; |
39 | 39 |
40 int prev_index = i; | 40 int prev_index = i; |
41 do { | 41 do { |
42 prev_index = (prev_index + 35) % 36; | 42 prev_index = (prev_index + 35) % 36; |
43 prev = input_ring.points[prev_index]; | 43 prev = input_ring.points[prev_index]; |
44 } while (prev.x() == p.x() && prev.y() == p.y()); | 44 } while (prev.x() == p.x() && prev.y() == p.y() && prev_index != i); |
45 | 45 |
46 int next_index = i; | 46 int next_index = i; |
47 do { | 47 do { |
48 next_index = (next_index + 1) % 36; | 48 next_index = (next_index + 1) % 36; |
49 next = input_ring.points[next_index]; | 49 next = input_ring.points[next_index]; |
50 } while (next.x() == p.x() && next.y() == p.y()); | 50 } while (next.x() == p.x() && next.y() == p.y() && next_index != i); |
51 | 51 |
52 gfx::Point delta0 = gfx::Point(sign(p.x() - prev.x()), | 52 gfx::Point delta0 = gfx::Point(sign(p.x() - prev.x()), |
53 sign(p.y() - prev.y())); | 53 sign(p.y() - prev.y())); |
54 gfx::Point delta1 = gfx::Point(sign(next.x() - p.x()), | 54 gfx::Point delta1 = gfx::Point(sign(next.x() - p.x()), |
55 sign(next.y() - p.y())); | 55 sign(next.y() - p.y())); |
56 | 56 |
57 if (delta0.x() == delta1.x() && delta0.y() == delta1.y()) { | 57 if (delta0.x() == delta1.x() && delta0.y() == delta1.y()) { |
58 ring.points[i] = gfx::Point( | 58 ring.points[i] = gfx::Point( |
59 input_ring.points[i].x() + outset * delta0.y(), | 59 input_ring.points[i].x() + outset * delta0.y(), |
60 input_ring.points[i].y() - outset * delta0.x()); | 60 input_ring.points[i].y() - outset * delta0.x()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 paint.setColor( | 123 paint.setColor( |
124 SkColorSetARGBMacro( | 124 SkColorSetARGBMacro( |
125 255 * (w - i) * (w - i) / (w * w), | 125 255 * (w - i) * (w - i) / (w * w), |
126 kFocusRingColorRed, kFocusRingColorGreen, kFocusRingColorBlue)); | 126 kFocusRingColorRed, kFocusRingColorGreen, kFocusRingColorBlue)); |
127 path = MakePath(ring_, i, offset); | 127 path = MakePath(ring_, i, offset); |
128 canvas->DrawPath(path, paint); | 128 canvas->DrawPath(path, paint); |
129 } | 129 } |
130 } | 130 } |
131 | 131 |
132 } // namespace chromeos | 132 } // namespace chromeos |
OLD | NEW |