]> khamidou — GitHub mirrors - electron.git/commitdiff
Flip the y axis in CapturePage API, fixes #148.
authorCheng Zhao <zcbenz@gmail.com>
Tue, 31 Dec 2013 06:40:42 +0000 (14:40 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 31 Dec 2013 06:40:42 +0000 (14:40 +0800)
browser/native_window.cc

index 2411464a723c9c03c9350ba4f033b029cfb63efa..8aa0a266e3aae30d1183255e2fd4e700e9927a54 100644 (file)
@@ -213,8 +213,11 @@ base::ProcessHandle NativeWindow::GetRenderProcessHandle() {
 
 void NativeWindow::CapturePage(const gfx::Rect& rect,
                                const CapturePageCallback& callback) {
+  gfx::Rect flipped_y_rect = rect;
+  flipped_y_rect.set_y(-rect.y());
+
   GetWebContents()->GetRenderViewHost()->CopyFromBackingStore(
-      rect,
+      flipped_y_rect,
       gfx::Size(),
       base::Bind(&NativeWindow::OnCapturePageDone,
                  weak_factory_.GetWeakPtr(),