From 494dff4c079910f0033e3ed63c975c791d6ded37 Mon Sep 17 00:00:00 2001 From: erikchen Date: Tue, 20 Dec 2016 17:00:22 -0800 Subject: [PATCH] Fix a screen capture issue on retina macOS devices. The CGDisplayStream API returns rects in physical pixel coordinates, not Density-Independent Pixel coordinates. The code was incorrectly re-applying the dip_to_pixel scaling. BUG=chromium:675490 Review-Url: https://codereview.webrtc.org/2588973002 Cr-Commit-Position: refs/heads/master@{#15720} --- webrtc/modules/desktop_capture/screen_capturer_mac.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac.mm b/webrtc/modules/desktop_capture/screen_capturer_mac.mm index f11b36d2d2..b1d7c9048e 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_mac.mm +++ b/webrtc/modules/desktop_capture/screen_capturer_mac.mm @@ -991,8 +991,10 @@ void ScreenCapturerMac::ScreenRefresh(CGRectCount count, DesktopRegion region; for (CGRectCount i = 0; i < count; ++i) { - // Convert from Density-Independent Pixel to physical pixel coordinates. - DesktopRect rect = ScaleAndRoundCGRect(rect_array[i], dip_to_pixel_scale_); + // All rects are already in physical pixel coordinates. + DesktopRect rect = DesktopRect::MakeXYWH( + rect_array[i].origin.x, rect_array[i].origin.y, + rect_array[i].size.width, rect_array[i].size.height); region.AddRect(rect); }