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 25 matching lines...) Expand all Loading... |
36 } | 36 } |
37 | 37 |
38 static void MakeAsyncCopyRequest( | 38 static void MakeAsyncCopyRequest( |
39 gfx::NativeWindow window, | 39 gfx::NativeWindow window, |
40 const gfx::Rect& source_rect, | 40 const gfx::Rect& source_rect, |
41 const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { | 41 const cc::CopyOutputRequest::CopyOutputRequestCallback& callback) { |
42 std::unique_ptr<cc::CopyOutputRequest> request = | 42 std::unique_ptr<cc::CopyOutputRequest> request = |
43 cc::CopyOutputRequest::CreateBitmapRequest(callback); | 43 cc::CopyOutputRequest::CreateBitmapRequest(callback); |
44 | 44 |
45 const display::Display& display = | 45 const display::Display& display = |
46 display::Screen::GetScreen()->GetDisplayNearestWindow(window); | 46 display::Screen::GetScreen()->GetDisplayNearestWindowAndroid(window); |
47 float scale = display.device_scale_factor(); | 47 float scale = display.device_scale_factor(); |
48 request->set_area(gfx::ScaleToEnclosingRect(source_rect, scale)); | 48 request->set_area(gfx::ScaleToEnclosingRect(source_rect, scale)); |
49 window->GetCompositor()->RequestCopyOfOutputOnRootLayer(std::move(request)); | 49 window->GetCompositor()->RequestCopyOfOutputOnRootLayer(std::move(request)); |
50 } | 50 } |
51 | 51 |
52 void GrabWindowSnapshotAndScaleAsync( | 52 void GrabWindowSnapshotAndScaleAsync( |
53 gfx::NativeWindow window, | 53 gfx::NativeWindow window, |
54 const gfx::Rect& source_rect, | 54 const gfx::Rect& source_rect, |
55 const gfx::Size& target_size, | 55 const gfx::Size& target_size, |
56 scoped_refptr<base::TaskRunner> background_task_runner, | 56 scoped_refptr<base::TaskRunner> background_task_runner, |
(...skipping 16 matching lines...) Expand all Loading... |
73 | 73 |
74 void GrabViewSnapshotAsync(gfx::NativeView view, | 74 void GrabViewSnapshotAsync(gfx::NativeView view, |
75 const gfx::Rect& source_rect, | 75 const gfx::Rect& source_rect, |
76 const GrabWindowSnapshotAsyncCallback& callback) { | 76 const GrabWindowSnapshotAsyncCallback& callback) { |
77 MakeAsyncCopyRequest( | 77 MakeAsyncCopyRequest( |
78 view->GetWindowAndroid(), source_rect, | 78 view->GetWindowAndroid(), source_rect, |
79 base::Bind(&SnapshotAsync::RunCallbackWithCopyOutputResult, callback)); | 79 base::Bind(&SnapshotAsync::RunCallbackWithCopyOutputResult, callback)); |
80 } | 80 } |
81 | 81 |
82 } // namespace ui | 82 } // namespace ui |
OLD | NEW |