Skip to content
  • Simon Mueller's avatar
    Bug 793722 - Capture screenshot of single window fails if... · 14236761
    Simon Mueller authored and Jehan's avatar Jehan committed
    ... thewindow is IE 11.
    
    The screenshot plugin for windows had a problem when capturing
    applications that use hardware rendering acceleration (e.g.
    Chromium-based Apps, IE11). Those applications seem to render their
    content to a device context (DC) that is different from the one that can
    be retrieved via GetDCEx(hWnd). So a screenshot that simply copies the
    main window DC will be incomplete (see bug attachment) or just plain
    black.
    
    This patch removes the code that uses GetDCEx for single window
    screenshots and always uses the display device context instead. This
    makes sure that all window contents are actually visible in the
    screenshot. With this change, we now have to set the source coordinates
    in the call to BitBlt() to the window's coordinates to exclude
    everything that isn't the window from the screenshot when doing a single
    window screenshot.
    
    Review comment by Jehan: as Simon notes in bug 793722, there is a
    regression though, which is that this new code cannot capture any part
    of a window which is not in any screen. This is still an improvement
    because at least for what is on screen, we always get exactly the same
    as what is displayed. This is especially true since hardware-accelerated
    applications are more and more common. So let's push this first commit
    and hope for further improvements.
    14236761