OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "remoting/client/viewport_geometry.h" |
| 6 |
| 7 namespace remoting { |
| 8 |
| 9 Point ConstrainPointToBounds(const Bounds& bounds, const Point& point) { |
| 10 Point new_point = point; |
| 11 if (new_point.x < bounds.left) { |
| 12 new_point.x = bounds.left; |
| 13 } else if (new_point.x > bounds.right) { |
| 14 new_point.x = bounds.right; |
| 15 } |
| 16 |
| 17 if (new_point.y < bounds.top) { |
| 18 new_point.y = bounds.top; |
| 19 } else if (new_point.y > bounds.bottom) { |
| 20 new_point.y = bounds.bottom; |
| 21 } |
| 22 return new_point; |
| 23 } |
| 24 |
| 25 } // namespace remoting |
OLD | NEW |