Merge pull request #7163 from MaxWhere/frame-sub-scale-fix

Frame subscriber improvements
This commit is contained in:
Cheng Zhao 2016-09-16 21:24:53 +09:00 committed by GitHub
commit da677b683b

View file

@ -7,6 +7,8 @@
#include "atom/common/native_mate_converters/gfx_converter.h"
#include "base/bind.h"
#include "content/public/browser/render_widget_host.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "atom/common/node_includes.h"
@ -41,6 +43,17 @@ bool FrameSubscriber::ShouldCaptureFrame(
if (only_dirty_)
rect = dirty_rect;
gfx::Size view_size = rect.size();
gfx::Size bitmap_size = view_size;
const gfx::NativeView native_view = view_->GetNativeView();
const float scale =
display::Screen::GetScreen()->GetDisplayNearestWindow(native_view)
.device_scale_factor();
if (scale > 1.0f)
bitmap_size = gfx::ScaleToCeiledSize(view_size, scale);
rect = gfx::Rect(rect.origin(), bitmap_size);
host->CopyFromBackingStore(
rect,
rect.size(),