| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/snapshot/snapshot.h" | 5 #include "ui/snapshot/snapshot.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 } | 37 } |
| 38 | 38 |
| 39 static void MakeAsyncCopyRequest( | 39 static void MakeAsyncCopyRequest( |
| 40 gfx::NativeWindow window, | 40 gfx::NativeWindow window, |
| 41 const gfx::Rect& source_rect, | 41 const gfx::Rect& source_rect, |
| 42 const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { | 42 const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { |
| 43 std::unique_ptr<cc::CopyOutputRequest> request = | 43 std::unique_ptr<cc::CopyOutputRequest> request = |
| 44 cc::CopyOutputRequest::CreateBitmapRequest(callback); | 44 cc::CopyOutputRequest::CreateBitmapRequest(callback); |
| 45 | 45 |
| 46 const display::Display& display = | 46 const display::Display& display = |
| 47 display::Screen::GetScreen()->GetDisplayNearestWindow(window); | 47 display::Screen::GetScreen()->GetDisplayNearestWindowAndroid(window); |
| 48 float scale = display.device_scale_factor(); | 48 float scale = display.device_scale_factor(); |
| 49 request->set_area(gfx::ScaleToEnclosingRect(source_rect, scale)); | 49 request->set_area(gfx::ScaleToEnclosingRect(source_rect, scale)); |
| 50 window->GetCompositor()->RequestCopyOfOutputOnRootLayer(std::move(request)); | 50 window->GetCompositor()->RequestCopyOfOutputOnRootLayer(std::move(request)); |
| 51 } | 51 } |
| 52 | 52 |
| 53 void GrabWindowSnapshotAndScaleAsync( | 53 void GrabWindowSnapshotAndScaleAsync( |
| 54 gfx::NativeWindow window, | 54 gfx::NativeWindow window, |
| 55 const gfx::Rect& source_rect, | 55 const gfx::Rect& source_rect, |
| 56 const gfx::Size& target_size, | 56 const gfx::Size& target_size, |
| 57 scoped_refptr<base::TaskRunner> background_task_runner, | 57 scoped_refptr<base::TaskRunner> background_task_runner, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 82 scoped_refptr<base::TaskRunner> background_task_runner, | 82 scoped_refptr<base::TaskRunner> background_task_runner, |
| 83 const GrabWindowSnapshotAsyncPNGCallback& callback) { | 83 const GrabWindowSnapshotAsyncPNGCallback& callback) { |
| 84 MakeAsyncCopyRequest(view->GetWindowAndroid(), | 84 MakeAsyncCopyRequest(view->GetWindowAndroid(), |
| 85 source_rect, | 85 source_rect, |
| 86 base::Bind(&SnapshotAsync::EncodeCopyOutputResult, | 86 base::Bind(&SnapshotAsync::EncodeCopyOutputResult, |
| 87 callback, | 87 callback, |
| 88 background_task_runner)); | 88 background_task_runner)); |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace ui | 91 } // namespace ui |
| OLD | NEW |