From f8775cf269ee1495a357ac4e4f03ebe9f47e1651 Mon Sep 17 00:00:00 2001 From: Jeroen Dhollander Date: Wed, 20 Apr 2022 15:26:12 +0200 Subject: [PATCH] Fix drawing of local mouse in CRD on ChromeOS ChromeOS will use DPI (see crrev.com/c/3322917), but the DesktopAndCursorComposer assumed pixels were used. Test: Manually ensured it works Bug: b/208370410 Change-Id: I5fee50d408fd204273946009e6653d4e60d1e458 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/259502 Reviewed-by: Alexander Cooper Commit-Queue: Jeroen Dhollander Cr-Commit-Position: refs/heads/main@{#36597} --- modules/desktop_capture/desktop_and_cursor_composer.cc | 2 +- modules/desktop_capture/desktop_frame.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/desktop_capture/desktop_and_cursor_composer.cc b/modules/desktop_capture/desktop_and_cursor_composer.cc index 355bfacfbb..bde91bd07b 100644 --- a/modules/desktop_capture/desktop_and_cursor_composer.cc +++ b/modules/desktop_capture/desktop_and_cursor_composer.cc @@ -218,7 +218,7 @@ void DesktopAndCursorComposer::OnCaptureResult( !desktop_capturer_->IsOccluded(cursor_position_)) { DesktopVector relative_position = cursor_position_.subtract(frame->top_left()); -#if defined(WEBRTC_MAC) +#if defined(WEBRTC_MAC) || defined(CHROMEOS) // On OSX, the logical(DIP) and physical coordinates are used mixingly. // For example, the captured cursor has its size in physical pixels(2x) // and location in logical(DIP) pixels on Retina monitor. This will cause diff --git a/modules/desktop_capture/desktop_frame.cc b/modules/desktop_capture/desktop_frame.cc index 9e4a899fd2..6e24fab4b5 100644 --- a/modules/desktop_capture/desktop_frame.cc +++ b/modules/desktop_capture/desktop_frame.cc @@ -112,7 +112,7 @@ DesktopRect DesktopFrame::rect() const { float DesktopFrame::scale_factor() const { float scale = 1.0f; -#if defined(WEBRTC_MAC) +#if defined(WEBRTC_MAC) || defined(CHROMEOS) // At least on Windows the logical and physical pixel are the same // See http://crbug.com/948362. if (!dpi().is_zero() && dpi().x() == dpi().y())