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_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 5 #ifndef UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
6 #define UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 6 #define UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
| 9 #include <vector> |
| 10 |
9 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
10 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
11 #include "ui/gfx/native_widget_types.h" | 13 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gfx/size.h" | 14 #include "ui/gfx/size.h" |
13 #include "ui/gfx/surface/surface_export.h" | 15 #include "ui/gfx/surface/surface_export.h" |
14 | 16 |
15 class AcceleratedPresenter; | 17 class AcceleratedPresenter; |
16 | 18 |
17 class SURFACE_EXPORT AcceleratedSurface { | 19 class SURFACE_EXPORT AcceleratedSurface { |
18 public: | 20 public: |
19 AcceleratedSurface(); | 21 AcceleratedSurface(); |
20 ~AcceleratedSurface(); | 22 ~AcceleratedSurface(); |
21 | 23 |
22 // Schedule a frame to be presented. The completion callback will be invoked | 24 // Schedule a frame to be presented. The completion callback will be invoked |
23 // when it is safe to write to the surface on another thread. The lock for | 25 // when it is safe to write to the surface on another thread. The lock for |
24 // this surface will be held while the completion callback runs. | 26 // this surface will be held while the completion callback runs. |
25 void AsyncPresentAndAcknowledge(HWND window, | 27 void AsyncPresentAndAcknowledge(HWND window, |
26 const gfx::Size& size, | 28 const gfx::Size& size, |
27 int64 surface_id, | 29 int64 surface_id, |
28 const base::Closure& completion_task); | 30 const base::Closure& completion_task); |
29 | 31 |
30 // Synchronously present a frame with no acknowledgement. | 32 // Synchronously present a frame with no acknowledgement. |
31 bool Present(HWND window); | 33 bool Present(HWND window); |
32 | 34 |
| 35 // Copies the surface data to |buf|. The image data is transformed so that it |
| 36 // fits in |size|. |
| 37 bool CopyTo(const gfx::Size& size, std::vector<unsigned char>* buf); |
| 38 |
33 // Temporarily release resources until a new surface is asynchronously | 39 // Temporarily release resources until a new surface is asynchronously |
34 // presented. Present will not be able to represent the last surface after | 40 // presented. Present will not be able to represent the last surface after |
35 // calling this and will return false. | 41 // calling this and will return false. |
36 void Suspend(); | 42 void Suspend(); |
37 | 43 |
38 private: | 44 private: |
39 linked_ptr<AcceleratedPresenter> presenter_; | 45 linked_ptr<AcceleratedPresenter> presenter_; |
40 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); | 46 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); |
41 }; | 47 }; |
42 | 48 |
43 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 49 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
OLD | NEW |