mac: Fix screen capture on secondary displays.

The old API CGScreenRegisterMoveCallback returned update rects in desktop
coordinates [secondary display has an origin != 0,0]. The new CGDisplayStream
API returns update rects in display coordinates [origin == 0,0]. Translating the
update rect based on the display's position on the desktop is now incorrect.

BUG=webrtc:6702

Review-Url: https://codereview.webrtc.org/2496413002
Cr-Commit-Position: refs/heads/master@{#15092}
This commit is contained in:
erikchen
2016-11-15 10:24:43 -08:00
committed by Commit bot
parent 5d54e185d5
commit 2a3eb9f367

View File

@ -990,13 +990,9 @@ void ScreenCapturerMac::ScreenRefresh(CGRectCount count,
ScreenConfigurationChanged();
DesktopRegion region;
DesktopVector translate_vector =
DesktopVector().subtract(screen_pixel_bounds_.top_left());
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_);
// Translate from local desktop to capturer framebuffer coordinates.
rect.Translate(translate_vector);
region.AddRect(rect);
}