diff --git a/modules/desktop_capture/mac/screen_capturer_mac.mm b/modules/desktop_capture/mac/screen_capturer_mac.mm index 542d1c5f43..9f506732a6 100644 --- a/modules/desktop_capture/mac/screen_capturer_mac.mm +++ b/modules/desktop_capture/mac/screen_capturer_mac.mm @@ -218,6 +218,17 @@ void ScreenCapturerMac::CaptureFrame() { ScreenConfigurationChanged(); } + // When screen is zoomed in/out, OSX only updates the part of Rects currently + // displayed on screen, with relative location to current top-left on screen. + // This will cause problems when we copy the dirty regions to the captured + // image. So we invalidate the whole screen to copy all the screen contents. + // With CGI method, the zooming will be ignored and the whole screen contents + // will be captured as before. + // With IOSurface method, the zoomed screen contents will be captured. + if (UAZoomEnabled()) { + helper_.InvalidateScreen(screen_pixel_bounds_.size()); + } + DesktopRegion region; helper_.TakeInvalidRegion(®ion); @@ -285,10 +296,9 @@ bool ScreenCapturerMac::SelectSource(SourceId id) { } bool ScreenCapturerMac::CgBlit(const DesktopFrame& frame, const DesktopRegion& region) { - // Copy the entire contents of the previous capture buffer, to capture over. - // TODO(wez): Get rid of this as per crbug.com/145064, or implement - // crbug.com/92354. - if (queue_.previous_frame()) { + // If not all screen region is dirty, copy the entire contents of the previous capture buffer, + // to capture over. + if (queue_.previous_frame() && !region.Equals(DesktopRegion(screen_pixel_bounds_))) { memcpy(frame.data(), queue_.previous_frame()->data(), frame.stride() * frame.size().height()); }