Skip to content

Commit

Permalink
Bug 1395289 - Convert from points to pixels when invalidating rect fo…
Browse files Browse the repository at this point in the history
…r screensharing when building on OS X older than 10.8; r=jesup

When we build for versions of OS X below 10.8 it is still necessary to
convert from points to pixels when invalidating rectangles as we use the
CGRegisterScreenRefreshCallback and CGRegisterMoveCallback interfaces.

--HG--
extra : rebase_source : cc3a405c1faaf010922b9acbe0edc21da15bb9ac
  • Loading branch information
dminor committed Aug 31, 2017
1 parent 74165be commit ed140d9
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1084,14 +1084,26 @@ explicit ScreenCallbackData(ScreenCapturerMac* capturer)
ScreenConfigurationChanged();

DesktopRegion region;
#if defined(MAC_OS_X_VERSION_10_8) && \
(MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_8)
for (CGRectCount i = 0; i < count; ++i) {
// All rects are already in physical pixel coordinates.
DesktopRect rect = DesktopRect::MakeXYWH(
rect_array[i].origin.x, rect_array[i].origin.y,
rect_array[i].size.width, rect_array[i].size.height);
region.AddRect(rect);
}
#else
DesktopVector translate_vector =
DesktopVector().subtract(screen_pixel_bounds_.top_left());
for (CGRectCount i = 0; i < count; ++i) {
// Convert from Density-Independent Pixel to physical pixel coordinates.
DesktopRect rect = ScaleAndRoundCGRect(rect_array[i], dip_to_pixel_scale_);
// Translate from local desktop to capturer framebuffer coordinates.
rect.Translate(translate_vector);
region.AddRect(rect);
}

#endif
helper_.InvalidateRegion(region);
}

Expand Down

0 comments on commit ed140d9

Please sign in to comment.