]> khamidou — GitHub mirrors - electron.git/commitdiff
Revert "browser: dont lose coordinates in capturepage src rect"
authorCheng Zhao <zcbenz@gmail.com>
Mon, 4 Jan 2016 11:37:25 +0000 (19:37 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 4 Jan 2016 11:37:25 +0000 (19:37 +0800)
This reverts commit 3c5e5053e3138bd3b661bac23ba8cf337addba36.

atom/browser/native_window.cc

index d946704b9f7307c701224436423c192a553612b2..c9837017e4869f7baf2c7c2daeebc5151493af8c 100644 (file)
@@ -278,22 +278,22 @@ void NativeWindow::CapturePage(const gfx::Rect& rect,
   }
 
   // Capture full page if user doesn't specify a |rect|.
-  const gfx::Rect view_rect = rect.IsEmpty() ? view->GetViewBounds() :
-                                               rect;
+  const gfx::Size view_size = rect.IsEmpty() ? view->GetViewBounds().size() :
+                                               rect.size();
 
   // By default, the requested bitmap size is the view size in screen
   // coordinates.  However, if there's more pixel detail available on the
   // current system, increase the requested bitmap size to capture it all.
-  gfx::Size bitmap_size = view_rect.size();
+  gfx::Size bitmap_size = view_size;
   const gfx::NativeView native_view = view->GetNativeView();
   gfx::Screen* const screen = gfx::Screen::GetScreenFor(native_view);
   const float scale =
       screen->GetDisplayNearestWindow(native_view).device_scale_factor();
   if (scale > 1.0f)
-    bitmap_size = gfx::ScaleToCeiledSize(view_rect.size(), scale);
+    bitmap_size = gfx::ScaleToCeiledSize(view_size, scale);
 
   host->CopyFromBackingStore(
-      view_rect,
+      gfx::Rect(view_size),
       bitmap_size,
       base::Bind(&NativeWindow::OnCapturePageDone,
                  weak_factory_.GetWeakPtr(),