Chromium Code Reviews| 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 17 matching lines...) Expand all Loading... | |
| 28 // You may either manipulate the desktop on the surface coordinate or manipulate | 28 // You may either manipulate the desktop on the surface coordinate or manipulate |
| 29 // the viewport on the desktop coordinate, depending on your choice of the | 29 // the viewport on the desktop coordinate, depending on your choice of the |
| 30 // reference frame. | 30 // reference frame. |
| 31 class DesktopViewport { | 31 class DesktopViewport { |
| 32 public: | 32 public: |
| 33 using TransformationCallback = base::Callback<void(const ViewMatrix&)>; | 33 using TransformationCallback = base::Callback<void(const ViewMatrix&)>; |
| 34 | 34 |
| 35 DesktopViewport(); | 35 DesktopViewport(); |
| 36 ~DesktopViewport(); | 36 ~DesktopViewport(); |
| 37 | 37 |
| 38 // Sets the |desktop_size_| and initializes the viewport when necessary. | 38 // Sets the |desktop_size_| and (re)initializes the viewport. |
| 39 void SetDesktopSize(int desktop_width, int desktop_height); | 39 void SetDesktopSize(int desktop_width, int desktop_height); |
| 40 | 40 |
| 41 // Sets the |surface_size_| and initializes the viewport when necessary. | 41 // Sets the |surface_size_| and (re)initializes the viewport if both |
|
nicholss
2017/05/26 20:12:49
I think this is too much to assume.
Yuwei
2017/05/26 21:38:21
I agree that we bring too many conditional branchi
| |
| 42 // dimensions are changed. | |
| 42 void SetSurfaceSize(int surface_width, int surface_height); | 43 void SetSurfaceSize(int surface_width, int surface_height); |
| 43 | 44 |
| 44 // Translates the desktop on the surface's reference frame by <dx, dy>. | 45 // Translates the desktop on the surface's reference frame by <dx, dy>. |
| 45 void MoveDesktop(float dx, float dy); | 46 void MoveDesktop(float dx, float dy); |
| 46 | 47 |
| 47 // Scales the desktop on the surface's reference frame at pivot point (px, py) | 48 // Scales the desktop on the surface's reference frame at pivot point (px, py) |
| 48 // by |scale|. | 49 // by |scale|. |
| 49 void ScaleDesktop(float px, float py, float scale); | 50 void ScaleDesktop(float px, float py, float scale); |
| 50 | 51 |
| 51 // Moves the viewport center by <x, y> on the desktop's coordinate. | 52 // Moves the viewport center by <x, y> on the desktop's coordinate. |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 | 117 |
| 117 TransformationCallback on_transformation_changed_; | 118 TransformationCallback on_transformation_changed_; |
| 118 | 119 |
| 119 // DesktopViewport is neither copyable nor movable. | 120 // DesktopViewport is neither copyable nor movable. |
| 120 DesktopViewport(const DesktopViewport&) = delete; | 121 DesktopViewport(const DesktopViewport&) = delete; |
| 121 DesktopViewport& operator=(const DesktopViewport&) = delete; | 122 DesktopViewport& operator=(const DesktopViewport&) = delete; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 } // namespace remoting | 125 } // namespace remoting |
| 125 #endif // REMOTING_CLIENT_UI_DESKTOP_VIEWPORT_H_ | 126 #endif // REMOTING_CLIENT_UI_DESKTOP_VIEWPORT_H_ |
| OLD | NEW |