Fix mouse not being shared with Handgouts on Win10

When setting display scale to 200%, the mouse was shared only
for the top left quarter.

Regressed since https://chromium-review.googlesource.com/641075.
Indeed frame->rect() takes into account scale_factor while the
frame is constructed with a size that does not take this scale
factor into account.

Also make sure to do a float disivison in DesktopFrame::scale_factor()
so that it returns 1.5 instead of 1 when dpi is 144 (i.e. 150%).

Bug: chromium:948362
Change-Id: Ic10f44946c9f1b53181244a44a5b45109c259f9f
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130371
Reviewed-by: Brave Yao <braveyao@webrtc.org>
Commit-Queue: Julien Isorce <julien.isorce@chromium.org>
Cr-Commit-Position: refs/heads/master@{#27424}
This commit is contained in:
Julien Isorce 2019-04-02 10:01:36 -07:00 committed by Commit Bot
parent 9435c61021
commit 27d5ad074c
2 changed files with 6 additions and 1 deletions

View File

@ -69,8 +69,13 @@ DesktopRect DesktopFrame::rect() const {
float DesktopFrame::scale_factor() const {
float scale = 1.0f;
#if defined(WEBRTC_MAC)
// 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())
scale = dpi().x() / kStandardDPI;
#endif
return scale;
}

View File

@ -22,7 +22,7 @@
namespace webrtc {
const int kStandardDPI = 96;
const float kStandardDPI = 96.0f;
// DesktopFrame represents a video frame captured from the screen.
class RTC_EXPORT DesktopFrame {