Fix multi-monitor support in the screen capturer for Mac.
This feature was broken in r5471.
BUG=361919
R=jiayl@webrtc.org
Committed: https://code.google.com/p/webrtc/source/detail?r=5937
Review URL: https://webrtc-codereview.appspot.com/12109004
git-svn-id: http://webrtc.googlecode.com/svn/trunk@5942 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/webrtc/modules/desktop_capture/mac/desktop_configuration.h b/webrtc/modules/desktop_capture/mac/desktop_configuration.h
index 031d92d..bb2339b 100644
--- a/webrtc/modules/desktop_capture/mac/desktop_configuration.h
+++ b/webrtc/modules/desktop_capture/mac/desktop_configuration.h
@@ -59,10 +59,11 @@
const MacDisplayConfiguration* FindDisplayConfigurationById(
CGDirectDisplayID id);
- // Bounds of the desktop in Density-Independent Pixels (DIPs).
+ // Bounds of the desktop excluding monitors with DPI settings different from
+ // the main monitor. In Density-Independent Pixels (DIPs).
DesktopRect bounds;
- // Bounds of the desktop in physical pixels.
+ // Same as bounds, but expressed in physical pixels.
DesktopRect pixel_bounds;
// Scale factor from DIPs to physical pixels.
diff --git a/webrtc/modules/desktop_capture/mac/desktop_configuration.mm b/webrtc/modules/desktop_capture/mac/desktop_configuration.mm
index 838973e..35fa65b 100644
--- a/webrtc/modules/desktop_capture/mac/desktop_configuration.mm
+++ b/webrtc/modules/desktop_capture/mac/desktop_configuration.mm
@@ -134,11 +134,15 @@
// Add the display to the configuration.
desktop_config.displays.push_back(display_config);
- // Update the desktop bounds to account for this display.
- desktop_config.bounds =
- JoinRects(desktop_config.bounds, display_config.bounds);
- desktop_config.pixel_bounds =
- JoinRects(desktop_config.pixel_bounds, display_config.pixel_bounds);
+ // Update the desktop bounds to account for this display, unless the current
+ // display uses different DPI settings.
+ if (display_config.dip_to_pixel_scale ==
+ desktop_config.dip_to_pixel_scale) {
+ desktop_config.bounds =
+ JoinRects(desktop_config.bounds, display_config.bounds);
+ desktop_config.pixel_bounds =
+ JoinRects(desktop_config.pixel_bounds, display_config.pixel_bounds);
+ }
}
return desktop_config;