Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Unified Diff: remoting/client/viewport_geometry.cc

Issue 2843373005: [Remoting Client] DesktopViewport Implementation (Closed)
Patch Set: Fix Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« remoting/client/viewport_geometry.h ('K') | « remoting/client/viewport_geometry.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/viewport_geometry.cc
diff --git a/remoting/client/viewport_geometry.cc b/remoting/client/viewport_geometry.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0c75aee4409e9d66633b6385213c9cef4fc630da
--- /dev/null
+++ b/remoting/client/viewport_geometry.cc
@@ -0,0 +1,25 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/client/viewport_geometry.h"
+
+namespace remoting {
+
+Point ConstrainPointToBounds(const Bounds& bounds, const Point& point) {
+ Point new_point = point;
+ if (new_point.x < bounds.left) {
+ new_point.x = bounds.left;
+ } else if (new_point.x > bounds.right) {
+ new_point.x = bounds.right;
+ }
+
+ if (new_point.y < bounds.top) {
+ new_point.y = bounds.top;
+ } else if (new_point.y > bounds.bottom) {
+ new_point.y = bounds.bottom;
+ }
+ return new_point;
+}
+
+} // namespace remoting
« remoting/client/viewport_geometry.h ('K') | « remoting/client/viewport_geometry.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698