From 7d055a6e630c343696f82002676e42a3beff380b Mon Sep 17 00:00:00 2001 From: "sergeyu@chromium.org" Date: Fri, 18 Apr 2014 23:45:38 +0000 Subject: [PATCH] Revert r5937 "Fix multi-monitor support in the screen capturer for Mac." This would break when rolled in chromium because some code in chromium depends on the code I changed in that change. TBR=jiayl@webrtc.org BUG=361919 Review URL: https://webrtc-codereview.appspot.com/12199005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5940 4adac7df-926f-26a2-2b94-8c16560cd09d --- .../mac/desktop_configuration.h | 9 ++++----- .../mac/desktop_configuration.mm | 18 +++++++----------- .../mouse_cursor_monitor_mac.mm | 2 +- .../desktop_capture/screen_capturer_mac.mm | 6 +++--- .../screen_capturer_mac_unittest.cc | 6 +++--- 5 files changed, 18 insertions(+), 23 deletions(-) diff --git a/webrtc/modules/desktop_capture/mac/desktop_configuration.h b/webrtc/modules/desktop_capture/mac/desktop_configuration.h index bac6440a6..031d92de2 100644 --- a/webrtc/modules/desktop_capture/mac/desktop_configuration.h +++ b/webrtc/modules/desktop_capture/mac/desktop_configuration.h @@ -59,12 +59,11 @@ struct MacDesktopConfiguration { const MacDisplayConfiguration* FindDisplayConfigurationById( CGDirectDisplayID id); - // Bounds of the desktop excluding monitors with DPI settings different from - // the main monitor. In Density-Independent Pixels (DIPs). - DesktopRect primary_bounds; + // Bounds of the desktop in Density-Independent Pixels (DIPs). + DesktopRect bounds; - // Same as primary_bounds, but expressed in physical pixels. - DesktopRect primary_pixel_bounds; + // Bounds of the desktop in physical pixels. + DesktopRect pixel_bounds; // Scale factor from DIPs to physical pixels. float dip_to_pixel_scale; diff --git a/webrtc/modules/desktop_capture/mac/desktop_configuration.mm b/webrtc/modules/desktop_capture/mac/desktop_configuration.mm index ce3391465..838973e42 100644 --- a/webrtc/modules/desktop_capture/mac/desktop_configuration.mm +++ b/webrtc/modules/desktop_capture/mac/desktop_configuration.mm @@ -134,15 +134,11 @@ MacDesktopConfiguration MacDesktopConfiguration::GetCurrent(Origin origin) { // Add the display to the configuration. desktop_config.displays.push_back(display_config); - // 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.primary_bounds = - JoinRects(desktop_config.primary_bounds, display_config.bounds); - desktop_config.primary_pixel_bounds = JoinRects( - desktop_config.primary_pixel_bounds, display_config.pixel_bounds); - } + // 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); } return desktop_config; @@ -159,8 +155,8 @@ bool operator==(const MacDisplayConfiguration& left, } bool MacDesktopConfiguration::Equals(const MacDesktopConfiguration& other) { - return primary_bounds.equals(other.primary_bounds) && - primary_pixel_bounds.equals(other.primary_pixel_bounds) && + return bounds.equals(other.bounds) && + pixel_bounds.equals(other.pixel_bounds) && dip_to_pixel_scale == other.dip_to_pixel_scale && displays == other.displays; } diff --git a/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm b/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm index 1b71e0a89..e88063381 100644 --- a/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm +++ b/webrtc/modules/desktop_capture/mouse_cursor_monitor_mac.mm @@ -200,7 +200,7 @@ void MouseCursorMonitorMac::Capture() { position.set(-1, -1); } } else { - position.subtract(configuration.primary_bounds.top_left()); + position.subtract(configuration.bounds.top_left()); } } if (state == INSIDE) { diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac.mm b/webrtc/modules/desktop_capture/screen_capturer_mac.mm index 1a2fd7c4d..2d5733906 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_mac.mm +++ b/webrtc/modules/desktop_capture/screen_capturer_mac.mm @@ -681,8 +681,8 @@ void ScreenCapturerMac::CgBlitPreLion(const DesktopFrame& frame, // Determine the display's position relative to the desktop, in pixels. DesktopRect display_bounds = display_config.pixel_bounds; - display_bounds.Translate(-desktop_config_.primary_pixel_bounds.left(), - -desktop_config_.primary_pixel_bounds.top()); + display_bounds.Translate(-desktop_config_.pixel_bounds.left(), + -desktop_config_.pixel_bounds.top()); // Determine which parts of the blit region, if any, lay within the monitor. DesktopRegion copy_region = region; @@ -854,7 +854,7 @@ void ScreenCapturerMac::ScreenConfigurationChanged() { screen_pixel_bounds_ = config ? config->pixel_bounds : DesktopRect(); dip_to_pixel_scale_ = config ? config->dip_to_pixel_scale : 1.0f; } else { - screen_pixel_bounds_ = desktop_config_.primary_pixel_bounds; + screen_pixel_bounds_ = desktop_config_.pixel_bounds; dip_to_pixel_scale_ = desktop_config_.dip_to_pixel_scale; } diff --git a/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc b/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc index f29eeb8bd..a51a4792c 100644 --- a/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc +++ b/webrtc/modules/desktop_capture/screen_capturer_mac_unittest.cc @@ -55,7 +55,7 @@ void ScreenCapturerMacTest::CaptureDoneCallback1( // Verify that the region contains full frame. DesktopRegion::Iterator it(frame->updated_region()); - EXPECT_TRUE(!it.IsAtEnd() && it.rect().equals(config.primary_pixel_bounds)); + EXPECT_TRUE(!it.IsAtEnd() && it.rect().equals(config.pixel_bounds)); } void ScreenCapturerMacTest::CaptureDoneCallback2( @@ -64,8 +64,8 @@ void ScreenCapturerMacTest::CaptureDoneCallback2( MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent( MacDesktopConfiguration::BottomLeftOrigin); - int width = config.primary_pixel_bounds.width(); - int height = config.primary_pixel_bounds.height(); + int width = config.pixel_bounds.width(); + int height = config.pixel_bounds.height(); EXPECT_EQ(width, frame->size().width()); EXPECT_EQ(height, frame->size().height());