| 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 #ifndef UI_SNAPSHOT_SNAPSHOT_H_ | 5 #ifndef UI_SNAPSHOT_SNAPSHOT_H_ |
| 6 #define UI_SNAPSHOT_SNAPSHOT_H_ | 6 #define UI_SNAPSHOT_SNAPSHOT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback_forward.h" | 10 #include "base/callback_forward.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 SNAPSHOT_EXPORT bool GrabWindowSnapshot( | 34 SNAPSHOT_EXPORT bool GrabWindowSnapshot( |
| 35 gfx::NativeWindow window, | 35 gfx::NativeWindow window, |
| 36 std::vector<unsigned char>* png_representation, | 36 std::vector<unsigned char>* png_representation, |
| 37 const gfx::Rect& snapshot_bounds); | 37 const gfx::Rect& snapshot_bounds); |
| 38 | 38 |
| 39 SNAPSHOT_EXPORT bool GrabViewSnapshot( | 39 SNAPSHOT_EXPORT bool GrabViewSnapshot( |
| 40 gfx::NativeView view, | 40 gfx::NativeView view, |
| 41 std::vector<unsigned char>* png_representation, | 41 std::vector<unsigned char>* png_representation, |
| 42 const gfx::Rect& snapshot_bounds); | 42 const gfx::Rect& snapshot_bounds); |
| 43 | 43 |
| 44 |
| 45 // These functions take a snapshot of |source_rect|, specified in layer space |
| 46 // coordinates (DIP for desktop, physical pixels for Android), and scale the |
| 47 // snapshot to |target_size| (in physical pixels), asynchronously. |
| 44 typedef base::Callback<void(const gfx::Image& snapshot)> | 48 typedef base::Callback<void(const gfx::Image& snapshot)> |
| 45 GrabWindowSnapshotAsyncCallback; | 49 GrabWindowSnapshotAsyncCallback; |
| 46 // GrabWindowSnapshotAndScaleAsync() copies snapshot of |source_rect| from | |
| 47 // window and scales it to |target_size| asynchronously. | |
| 48 SNAPSHOT_EXPORT void GrabWindowSnapshotAndScaleAsync( | 50 SNAPSHOT_EXPORT void GrabWindowSnapshotAndScaleAsync( |
| 49 gfx::NativeWindow window, | 51 gfx::NativeWindow window, |
| 50 const gfx::Rect& source_rect, | 52 const gfx::Rect& source_rect, |
| 51 const gfx::Size& target_size, | 53 const gfx::Size& target_size, |
| 52 scoped_refptr<base::TaskRunner> background_task_runner, | 54 scoped_refptr<base::TaskRunner> background_task_runner, |
| 53 const GrabWindowSnapshotAsyncCallback& callback); | 55 const GrabWindowSnapshotAsyncCallback& callback); |
| 54 | 56 |
| 55 typedef base::Callback<void(scoped_refptr<base::RefCountedBytes> png_data)> | 57 typedef base::Callback<void(scoped_refptr<base::RefCountedBytes> png_data)> |
| 56 GrabWindowSnapshotAsyncPNGCallback; | 58 GrabWindowSnapshotAsyncPNGCallback; |
| 57 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync( | 59 SNAPSHOT_EXPORT void GrabWindowSnapshotAsync( |
| 58 gfx::NativeWindow window, | 60 gfx::NativeWindow window, |
| 59 const gfx::Rect& source_rect, | 61 const gfx::Rect& source_rect, |
| 60 scoped_refptr<base::TaskRunner> background_task_runner, | 62 scoped_refptr<base::TaskRunner> background_task_runner, |
| 61 const GrabWindowSnapshotAsyncPNGCallback& callback); | 63 const GrabWindowSnapshotAsyncPNGCallback& callback); |
| 62 SNAPSHOT_EXPORT void GrabViewSnapshotAsync( | 64 SNAPSHOT_EXPORT void GrabViewSnapshotAsync( |
| 63 gfx::NativeView view, | 65 gfx::NativeView view, |
| 64 const gfx::Rect& source_rect, | 66 const gfx::Rect& source_rect, |
| 65 scoped_refptr<base::TaskRunner> background_task_runner, | 67 scoped_refptr<base::TaskRunner> background_task_runner, |
| 66 const GrabWindowSnapshotAsyncPNGCallback& callback); | 68 const GrabWindowSnapshotAsyncPNGCallback& callback); |
| 67 | 69 |
| 68 } // namespace ui | 70 } // namespace ui |
| 69 | 71 |
| 70 #endif // UI_SNAPSHOT_SNAPSHOT_H_ | 72 #endif // UI_SNAPSHOT_SNAPSHOT_H_ |
| OLD | NEW |