| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef REMOTING_CLIENT_UI_DESKTOP_VIEWPORT_H_ | 5 #ifndef REMOTING_CLIENT_UI_DESKTOP_VIEWPORT_H_ |
| 6 #define REMOTING_CLIENT_UI_DESKTOP_VIEWPORT_H_ | 6 #define REMOTING_CLIENT_UI_DESKTOP_VIEWPORT_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "remoting/client/ui/view_matrix.h" | 9 #include "remoting/client/ui/view_matrix.h" |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // Moves the viewport center by <x, y> on the desktop's coordinate. | 51 // Moves the viewport center by <x, y> on the desktop's coordinate. |
| 52 void MoveViewport(float dx, float dy); | 52 void MoveViewport(float dx, float dy); |
| 53 | 53 |
| 54 // Sets the viewport center to (x, y) on the desktop's coordinate. | 54 // Sets the viewport center to (x, y) on the desktop's coordinate. |
| 55 void SetViewportCenter(float x, float y); | 55 void SetViewportCenter(float x, float y); |
| 56 | 56 |
| 57 // Returns the current center of the viewport on the desktop's coordinate. | 57 // Returns the current center of the viewport on the desktop's coordinate. |
| 58 ViewMatrix::Point GetViewportCenter() const; | 58 ViewMatrix::Point GetViewportCenter() const; |
| 59 | 59 |
| 60 // Returns true if |point| is within the bounds of the desktop. |
| 61 bool IsPointWithinDesktopBounds(const ViewMatrix::Point& point) const; |
| 62 |
| 60 // Constrains |point| within the bounds of the desktop. Do nothing if the | 63 // Constrains |point| within the bounds of the desktop. Do nothing if the |
| 61 // desktop size is not set. | 64 // desktop size is not set. |
| 62 ViewMatrix::Point ConstrainPointToDesktop( | 65 ViewMatrix::Point ConstrainPointToDesktop( |
| 63 const ViewMatrix::Point& point) const; | 66 const ViewMatrix::Point& point) const; |
| 64 | 67 |
| 65 // Registers the callback to be called once the transformation has changed. | 68 // Registers the callback to be called once the transformation has changed. |
| 66 // run_immediately: If true and the viewport is ready to be used, the callback | 69 // run_immediately: If true and the viewport is ready to be used, the callback |
| 67 // will be called immedately with the transformation matrix. | 70 // will be called immedately with the transformation matrix. |
| 68 void RegisterOnTransformationChangedCallback( | 71 void RegisterOnTransformationChangedCallback( |
| 69 const TransformationCallback& callback, | 72 const TransformationCallback& callback, |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 116 |
| 114 TransformationCallback on_transformation_changed_; | 117 TransformationCallback on_transformation_changed_; |
| 115 | 118 |
| 116 // DesktopViewport is neither copyable nor movable. | 119 // DesktopViewport is neither copyable nor movable. |
| 117 DesktopViewport(const DesktopViewport&) = delete; | 120 DesktopViewport(const DesktopViewport&) = delete; |
| 118 DesktopViewport& operator=(const DesktopViewport&) = delete; | 121 DesktopViewport& operator=(const DesktopViewport&) = delete; |
| 119 }; | 122 }; |
| 120 | 123 |
| 121 } // namespace remoting | 124 } // namespace remoting |
| 122 #endif // REMOTING_CLIENT_UI_DESKTOP_VIEWPORT_H_ | 125 #endif // REMOTING_CLIENT_UI_DESKTOP_VIEWPORT_H_ |
| OLD | NEW |