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
This commit is contained in:
sergeyu@chromium.org 2014-04-18 23:45:38 +00:00
parent 0daa8be9d6
commit 7d055a6e63
5 changed files with 18 additions and 23 deletions

View File

@ -59,12 +59,11 @@ struct MacDesktopConfiguration {
const MacDisplayConfiguration* FindDisplayConfigurationById( const MacDisplayConfiguration* FindDisplayConfigurationById(
CGDirectDisplayID id); CGDirectDisplayID id);
// Bounds of the desktop excluding monitors with DPI settings different from // Bounds of the desktop in Density-Independent Pixels (DIPs).
// the main monitor. In Density-Independent Pixels (DIPs). DesktopRect bounds;
DesktopRect primary_bounds;
// Same as primary_bounds, but expressed in physical pixels. // Bounds of the desktop in physical pixels.
DesktopRect primary_pixel_bounds; DesktopRect pixel_bounds;
// Scale factor from DIPs to physical pixels. // Scale factor from DIPs to physical pixels.
float dip_to_pixel_scale; float dip_to_pixel_scale;

View File

@ -134,15 +134,11 @@ MacDesktopConfiguration MacDesktopConfiguration::GetCurrent(Origin origin) {
// Add the display to the configuration. // Add the display to the configuration.
desktop_config.displays.push_back(display_config); desktop_config.displays.push_back(display_config);
// Update the desktop bounds to account for this display, unless the current // Update the desktop bounds to account for this display.
// display uses different DPI settings. desktop_config.bounds =
if (display_config.dip_to_pixel_scale == JoinRects(desktop_config.bounds, display_config.bounds);
desktop_config.dip_to_pixel_scale) { desktop_config.pixel_bounds =
desktop_config.primary_bounds = JoinRects(desktop_config.pixel_bounds, display_config.pixel_bounds);
JoinRects(desktop_config.primary_bounds, display_config.bounds);
desktop_config.primary_pixel_bounds = JoinRects(
desktop_config.primary_pixel_bounds, display_config.pixel_bounds);
}
} }
return desktop_config; return desktop_config;
@ -159,8 +155,8 @@ bool operator==(const MacDisplayConfiguration& left,
} }
bool MacDesktopConfiguration::Equals(const MacDesktopConfiguration& other) { bool MacDesktopConfiguration::Equals(const MacDesktopConfiguration& other) {
return primary_bounds.equals(other.primary_bounds) && return bounds.equals(other.bounds) &&
primary_pixel_bounds.equals(other.primary_pixel_bounds) && pixel_bounds.equals(other.pixel_bounds) &&
dip_to_pixel_scale == other.dip_to_pixel_scale && dip_to_pixel_scale == other.dip_to_pixel_scale &&
displays == other.displays; displays == other.displays;
} }

View File

@ -200,7 +200,7 @@ void MouseCursorMonitorMac::Capture() {
position.set(-1, -1); position.set(-1, -1);
} }
} else { } else {
position.subtract(configuration.primary_bounds.top_left()); position.subtract(configuration.bounds.top_left());
} }
} }
if (state == INSIDE) { if (state == INSIDE) {

View File

@ -681,8 +681,8 @@ void ScreenCapturerMac::CgBlitPreLion(const DesktopFrame& frame,
// Determine the display's position relative to the desktop, in pixels. // Determine the display's position relative to the desktop, in pixels.
DesktopRect display_bounds = display_config.pixel_bounds; DesktopRect display_bounds = display_config.pixel_bounds;
display_bounds.Translate(-desktop_config_.primary_pixel_bounds.left(), display_bounds.Translate(-desktop_config_.pixel_bounds.left(),
-desktop_config_.primary_pixel_bounds.top()); -desktop_config_.pixel_bounds.top());
// Determine which parts of the blit region, if any, lay within the monitor. // Determine which parts of the blit region, if any, lay within the monitor.
DesktopRegion copy_region = region; DesktopRegion copy_region = region;
@ -854,7 +854,7 @@ void ScreenCapturerMac::ScreenConfigurationChanged() {
screen_pixel_bounds_ = config ? config->pixel_bounds : DesktopRect(); screen_pixel_bounds_ = config ? config->pixel_bounds : DesktopRect();
dip_to_pixel_scale_ = config ? config->dip_to_pixel_scale : 1.0f; dip_to_pixel_scale_ = config ? config->dip_to_pixel_scale : 1.0f;
} else { } 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; dip_to_pixel_scale_ = desktop_config_.dip_to_pixel_scale;
} }

View File

@ -55,7 +55,7 @@ void ScreenCapturerMacTest::CaptureDoneCallback1(
// Verify that the region contains full frame. // Verify that the region contains full frame.
DesktopRegion::Iterator it(frame->updated_region()); 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( void ScreenCapturerMacTest::CaptureDoneCallback2(
@ -64,8 +64,8 @@ void ScreenCapturerMacTest::CaptureDoneCallback2(
MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent( MacDesktopConfiguration config = MacDesktopConfiguration::GetCurrent(
MacDesktopConfiguration::BottomLeftOrigin); MacDesktopConfiguration::BottomLeftOrigin);
int width = config.primary_pixel_bounds.width(); int width = config.pixel_bounds.width();
int height = config.primary_pixel_bounds.height(); int height = config.pixel_bounds.height();
EXPECT_EQ(width, frame->size().width()); EXPECT_EQ(width, frame->size().width());
EXPECT_EQ(height, frame->size().height()); EXPECT_EQ(height, frame->size().height());