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(
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;

View File

@ -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;
}

View File

@ -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) {

View File

@ -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;
}

View File

@ -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());