OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "ppapi/c/dev/ppb_surface_3d_dev.h" | 9 #include "ppapi/c/dev/ppb_surface_3d_dev.h" |
10 #include "webkit/plugins/ppapi/plugin_delegate.h" | 10 #include "webkit/plugins/ppapi/plugin_delegate.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 virtual ~PPB_Surface3D_Impl(); | 23 virtual ~PPB_Surface3D_Impl(); |
24 | 24 |
25 static const PPB_Surface3D_Dev* GetInterface(); | 25 static const PPB_Surface3D_Dev* GetInterface(); |
26 | 26 |
27 // Resource override. | 27 // Resource override. |
28 virtual PPB_Surface3D_Impl* AsPPB_Surface3D_Impl(); | 28 virtual PPB_Surface3D_Impl* AsPPB_Surface3D_Impl(); |
29 | 29 |
30 bool Init(PP_Config3D_Dev config, | 30 bool Init(PP_Config3D_Dev config, |
31 const int32_t* attrib_list); | 31 const int32_t* attrib_list); |
32 | 32 |
33 PluginDelegate::PlatformContext3D* context() const { | 33 PPB_Context3D_Impl* context() const { |
34 return context_; | 34 return context_; |
35 } | 35 } |
36 | 36 |
37 // Binds/unbinds the graphics of this surface with the associated instance. | 37 // Binds/unbinds the graphics of this surface with the associated instance. |
38 // If the surface is bound, anything drawn on the surface appears on instance | 38 // If the surface is bound, anything drawn on the surface appears on instance |
39 // window. Returns true if binding/unbinding is successful. | 39 // window. Returns true if binding/unbinding is successful. |
40 bool BindToInstance(bool bind); | 40 bool BindToInstance(bool bind); |
41 | 41 |
42 // Binds the context such that all draw calls to context | 42 // Binds the context such that all draw calls to context |
43 // affect this surface. To unbind call this function will NULL context. | 43 // affect this surface. To unbind call this function will NULL context. |
44 // Returns true if successful. | 44 // Returns true if successful. |
45 bool BindToContext(PluginDelegate::PlatformContext3D* context); | 45 bool BindToContext(PPB_Context3D_Impl* context); |
46 | 46 |
47 unsigned int GetBackingTextureId(); | 47 unsigned int GetBackingTextureId(); |
48 | 48 |
49 bool SwapBuffers(PP_CompletionCallback callback); | 49 bool SwapBuffers(PP_CompletionCallback callback); |
50 | 50 |
51 void ViewInitiatedPaint(); | 51 void ViewInitiatedPaint(); |
52 void ViewFlushedPaint(); | 52 void ViewFlushedPaint(); |
53 | 53 |
54 private: | 54 private: |
55 // Called when SwapBuffers is complete. | 55 // Called when SwapBuffers is complete. |
56 void OnSwapBuffers(); | 56 void OnSwapBuffers(); |
57 | 57 |
58 bool bound_to_instance_; | 58 bool bound_to_instance_; |
59 | 59 |
60 // True when the page's SwapBuffers has been issued but not returned yet. | 60 // True when the page's SwapBuffers has been issued but not returned yet. |
61 bool swap_initiated_; | 61 bool swap_initiated_; |
62 PP_CompletionCallback swap_callback_; | 62 PP_CompletionCallback swap_callback_; |
63 | 63 |
64 // The context this surface is currently bound to. | 64 // The context this surface is currently bound to. |
65 PluginDelegate::PlatformContext3D* context_; | 65 PPB_Context3D_Impl* context_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(PPB_Surface3D_Impl); | 67 DISALLOW_COPY_AND_ASSIGN(PPB_Surface3D_Impl); |
68 }; | 68 }; |
69 | 69 |
70 } // namespace ppapi | 70 } // namespace ppapi |
71 } // namespace webkit | 71 } // namespace webkit |
72 | 72 |
73 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ | 73 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ |
OLD | NEW |