| 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 <d3d9.h> | 9 #include <d3d9.h> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 AcceleratedPresenter(); | 26 AcceleratedPresenter(); |
| 27 | 27 |
| 28 // The public member functions are called on the main thread. | 28 // The public member functions are called on the main thread. |
| 29 void AsyncPresentAndAcknowledge( | 29 void AsyncPresentAndAcknowledge( |
| 30 gfx::NativeWindow window, | 30 gfx::NativeWindow window, |
| 31 const gfx::Size& size, | 31 const gfx::Size& size, |
| 32 int64 surface_id, | 32 int64 surface_id, |
| 33 const base::Callback<void(bool)>& completion_task); | 33 const base::Callback<void(bool)>& completion_task); |
| 34 bool Present(gfx::NativeWindow window); | 34 bool Present(gfx::NativeWindow window); |
| 35 bool CopyTo(const gfx::Size& size, void* buf); |
| 35 void Suspend(); | 36 void Suspend(); |
| 36 void WaitForPendingTasks(); | 37 void WaitForPendingTasks(); |
| 37 | 38 |
| 38 private: | 39 private: |
| 39 friend class base::RefCountedThreadSafe<AcceleratedPresenter>; | 40 friend class base::RefCountedThreadSafe<AcceleratedPresenter>; |
| 40 | 41 |
| 41 ~AcceleratedPresenter(); | 42 ~AcceleratedPresenter(); |
| 42 | 43 |
| 43 // These member functions are called on the PresentThread with which the | 44 // These member functions are called on the PresentThread with which the |
| 44 // presenter has affinity. | 45 // presenter has affinity. |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 // this surface will be held while the completion callback runs. | 79 // this surface will be held while the completion callback runs. |
| 79 void AsyncPresentAndAcknowledge( | 80 void AsyncPresentAndAcknowledge( |
| 80 gfx::NativeWindow window, | 81 gfx::NativeWindow window, |
| 81 const gfx::Size& size, | 82 const gfx::Size& size, |
| 82 int64 surface_id, | 83 int64 surface_id, |
| 83 const base::Callback<void(bool)>& completion_task); | 84 const base::Callback<void(bool)>& completion_task); |
| 84 | 85 |
| 85 // Synchronously present a frame with no acknowledgement. | 86 // Synchronously present a frame with no acknowledgement. |
| 86 bool Present(gfx::NativeWindow window); | 87 bool Present(gfx::NativeWindow window); |
| 87 | 88 |
| 89 // Copies the surface data to |buf|. The image data is transformed so that it |
| 90 // fits in |size|. |
| 91 // Caller must ensure that |buf| is allocated with the size no less than |
| 92 // |4 * size.width() * size.height()| bytes. |
| 93 bool CopyTo(const gfx::Size& size, void* buf); |
| 94 |
| 88 // Temporarily release resources until a new surface is asynchronously | 95 // Temporarily release resources until a new surface is asynchronously |
| 89 // presented. Present will not be able to represent the last surface after | 96 // presented. Present will not be able to represent the last surface after |
| 90 // calling this and will return false. | 97 // calling this and will return false. |
| 91 void Suspend(); | 98 void Suspend(); |
| 92 | 99 |
| 93 private: | 100 private: |
| 94 scoped_refptr<AcceleratedPresenter> presenter_; | 101 scoped_refptr<AcceleratedPresenter> presenter_; |
| 95 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); | 102 DISALLOW_COPY_AND_ASSIGN(AcceleratedSurface); |
| 96 }; | 103 }; |
| 97 | 104 |
| 98 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ | 105 #endif // UI_GFX_SURFACE_ACCELERATED_SURFACE_WIN_H_ |
| OLD | NEW |