| Index: remoting/client/desktop_viewport.cc
|
| diff --git a/remoting/client/desktop_viewport.cc b/remoting/client/desktop_viewport.cc
|
| index f1b3dda978bd0dc1910ea90a3914b3fca7392fad..dc8b99dc4a06f50b765d73817cb6740535713518 100644
|
| --- a/remoting/client/desktop_viewport.cc
|
| +++ b/remoting/client/desktop_viewport.cc
|
| @@ -21,27 +21,15 @@ DesktopViewport::DesktopViewport() : desktop_to_surface_transform_() {}
|
| DesktopViewport::~DesktopViewport() {}
|
|
|
| void DesktopViewport::SetDesktopSize(int desktop_width, int desktop_height) {
|
| - bool need_resize_to_fit = !desktop_size_ready_ && surface_size_ready_;
|
| desktop_size_.x = desktop_width;
|
| desktop_size_.y = desktop_height;
|
| - desktop_size_ready_ = true;
|
| - if (need_resize_to_fit) {
|
| - ResizeToFit();
|
| - } else if (IsViewportReady()) {
|
| - UpdateViewport();
|
| - }
|
| + ResizeToFit();
|
| }
|
|
|
| void DesktopViewport::SetSurfaceSize(int surface_width, int surface_height) {
|
| - bool need_resize_to_fit = desktop_size_ready_ && !surface_size_ready_;
|
| surface_size_.x = surface_width;
|
| surface_size_.y = surface_height;
|
| - surface_size_ready_ = true;
|
| - if (need_resize_to_fit) {
|
| - ResizeToFit();
|
| - } else if (IsViewportReady()) {
|
| - UpdateViewport();
|
| - }
|
| + ResizeToFit();
|
| }
|
|
|
| void DesktopViewport::MoveDesktop(float dx, float dy) {
|
| @@ -70,7 +58,9 @@ void DesktopViewport::RegisterOnTransformationChangedCallback(
|
| }
|
|
|
| void DesktopViewport::ResizeToFit() {
|
| - DCHECK(IsViewportReady());
|
| + if (!IsViewportReady()) {
|
| + return;
|
| + }
|
|
|
| // <---Desktop Width---->
|
| // +==========+---------+
|
| @@ -93,11 +83,13 @@ void DesktopViewport::ResizeToFit() {
|
| float scale = std::max(surface_size_.x / desktop_size_.x,
|
| surface_size_.y / desktop_size_.y);
|
| desktop_to_surface_transform_.SetScale(scale);
|
| + desktop_to_surface_transform_.SetOffset({0.f, 0.f});
|
| UpdateViewport();
|
| }
|
|
|
| bool DesktopViewport::IsViewportReady() const {
|
| - return desktop_size_ready_ && surface_size_ready_;
|
| + return desktop_size_.x != 0 && desktop_size_.y != 0 && surface_size_.x != 0 &&
|
| + surface_size_.y != 0;
|
| }
|
|
|
| void DesktopViewport::UpdateViewport() {
|
|
|