]> khamidou — GitHub mirrors - electron.git/commitdiff
No more need to flip rect for capturePage, fixes #589.
authorCheng Zhao <zcbenz@gmail.com>
Thu, 21 Aug 2014 04:40:31 +0000 (12:40 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Thu, 21 Aug 2014 04:40:31 +0000 (12:40 +0800)
atom/browser/native_window.cc

index 0ec5f218c9ce97ebabd86d4918ddc53d7249b660..8391a608aa90570428646560d206e44cef58a0df 100644 (file)
@@ -249,18 +249,10 @@ void NativeWindow::CapturePage(const gfx::Rect& rect,
     return;
   }
 
-  gfx::Rect flipped_y_rect = rect;
-  flipped_y_rect.set_y(-rect.y());
-
-  gfx::Size size;
-  if (flipped_y_rect.IsEmpty())
-    size = render_widget_host_view->GetViewBounds().size();
-  else
-    size = flipped_y_rect.size();
-
   GetWebContents()->GetRenderViewHost()->CopyFromBackingStore(
-      flipped_y_rect,
-      size,
+      rect,
+      rect.IsEmpty() ? render_widget_host_view->GetViewBounds().size() :
+                       rect.size(),
       base::Bind(&NativeWindow::OnCapturePageDone,
                  weak_factory_.GetWeakPtr(),
                  callback),