| Index: remoting/client/ui/desktop_viewport.cc
|
| diff --git a/remoting/client/ui/desktop_viewport.cc b/remoting/client/ui/desktop_viewport.cc
|
| index e85356563e1b79224c340e859f53f8873e1f42d0..523afbde4150c3285f5cd1c7171d6c5f8f4cde18 100644
|
| --- a/remoting/client/ui/desktop_viewport.cc
|
| +++ b/remoting/client/ui/desktop_viewport.cc
|
| @@ -60,6 +60,26 @@ void DesktopViewport::SetViewportCenter(float x, float y) {
|
| MoveViewport(x - old_center.x, y - old_center.y);
|
| }
|
|
|
| +ViewMatrix::Point DesktopViewport::GetViewportCenter() const {
|
| + if (!IsViewportReady()) {
|
| + LOG(WARNING) << "Viewport is not ready before getting the viewport center";
|
| + return {0.f, 0.f};
|
| + }
|
| + return desktop_to_surface_transform_.Invert().MapPoint(
|
| + {surface_size_.x / 2.f, surface_size_.y / 2.f});
|
| +}
|
| +
|
| +ViewMatrix::Point DesktopViewport::ConstrainPointToDesktop(
|
| + const ViewMatrix::Point& point) const {
|
| + if (!IsViewportReady()) {
|
| + LOG(WARNING) << "Cannot constrain point to desktop. Viewport is not ready.";
|
| + return point;
|
| + }
|
| +
|
| + return ConstrainPointToBounds({0.f, desktop_size_.x, 0.f, desktop_size_.y},
|
| + point);
|
| +}
|
| +
|
| void DesktopViewport::RegisterOnTransformationChangedCallback(
|
| const TransformationCallback& callback,
|
| bool run_immediately) {
|
| @@ -212,11 +232,6 @@ DesktopViewport::Bounds DesktopViewport::GetViewportCenterBounds() const {
|
| return bounds;
|
| }
|
|
|
| -ViewMatrix::Point DesktopViewport::GetViewportCenter() const {
|
| - return desktop_to_surface_transform_.Invert().MapPoint(
|
| - {surface_size_.x / 2.f, surface_size_.y / 2.f});
|
| -}
|
| -
|
| void DesktopViewport::MoveViewportWithoutUpdate(float dx, float dy) {
|
| // <dx, dy> is defined on desktop's reference frame. Translation must be
|
| // flipped and scaled.
|
|
|