OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <algorithm> | 5 #include <algorithm> |
6 #include <cmath> | 6 #include <cmath> |
7 #include <new> | 7 #include <new> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "services/prediction/proximity_info_factory.h" | 10 #include "services/prediction/proximity_info_factory.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 const int right = left + k.kwidth; | 180 const int right = left + k.kwidth; |
181 const int top = k.ky; | 181 const int top = k.ky; |
182 const int bottom = top + k.kheight; | 182 const int bottom = top + k.kheight; |
183 const int edge_x = x < left ? left : (x > right ? right : x); | 183 const int edge_x = x < left ? left : (x > right ? right : x); |
184 const int edge_y = y < top ? top : (y > bottom ? bottom : y); | 184 const int edge_y = y < top ? top : (y > bottom ? bottom : y); |
185 const int dx = x - edge_x; | 185 const int dx = x - edge_x; |
186 const int dy = y - edge_y; | 186 const int dy = y - edge_y; |
187 return dx * dx + dy * dy; | 187 return dx * dx + dy * dy; |
188 } | 188 } |
189 | 189 |
190 } // namespace prediction | 190 } // namespace prediction |
OLD | NEW |