OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "ppapi/c/dev/ppb_surface_3d_dev.h" |
| 10 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 11 #include "webkit/plugins/ppapi/resource.h" |
| 12 |
| 13 namespace gfx { |
| 14 class Size; |
| 15 } |
| 16 |
| 17 namespace webkit { |
| 18 namespace ppapi { |
| 19 |
| 20 class PPB_Surface3D_Impl : public Resource { |
| 21 public: |
| 22 explicit PPB_Surface3D_Impl(PluginInstance* instance); |
| 23 virtual ~PPB_Surface3D_Impl(); |
| 24 |
| 25 static const PPB_Surface3D_Dev* GetInterface(); |
| 26 |
| 27 // Resource override. |
| 28 virtual PPB_Surface3D_Impl* AsPPB_Surface3D_Impl(); |
| 29 |
| 30 bool Init(PP_Config3D_Dev config, |
| 31 const int32_t* attrib_list); |
| 32 |
| 33 PluginInstance* instance() const { |
| 34 return instance_; |
| 35 } |
| 36 PluginDelegate::PlatformContext3D* context() const { |
| 37 return context_; |
| 38 } |
| 39 |
| 40 // Binds/unbinds the graphics of this surface with the associated instance. |
| 41 // If the surface is bound, anything drawn on the surface appears on instance |
| 42 // window. Returns true if binding/unbinding is successful. |
| 43 bool BindToInstance(bool bind); |
| 44 |
| 45 // Binds the context such that all draw calls to context |
| 46 // affect this surface. To unbind call this function will NULL context. |
| 47 // Returns true if successful. |
| 48 bool BindToContext(PluginDelegate::PlatformContext3D* context); |
| 49 |
| 50 unsigned int GetBackingTextureId(); |
| 51 |
| 52 bool SwapBuffers(); |
| 53 |
| 54 private: |
| 55 // Called when SwapBuffers is complete. |
| 56 void OnSwapBuffers(); |
| 57 |
| 58 // Plugin instance this surface is associated with. |
| 59 PluginInstance* instance_; |
| 60 bool bound_to_instance_; |
| 61 |
| 62 // The context this surface is currently bound to. |
| 63 PluginDelegate::PlatformContext3D* context_; |
| 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(PPB_Surface3D_Impl); |
| 66 }; |
| 67 |
| 68 } // namespace ppapi |
| 69 } // namespace webkit |
| 70 |
| 71 #endif // WEBKIT_PLUGINS_PPAPI_PPB_SURFACE_3D_IMPL_H_ |
OLD | NEW |