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_CONTEXT_3D_IMPL_H_ |
| 6 #define WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/scoped_ptr.h" |
| 10 #include "ppapi/c/dev/ppb_context_3d_dev.h" |
| 11 #include "webkit/plugins/ppapi/plugin_delegate.h" |
| 12 #include "webkit/plugins/ppapi/resource.h" |
| 13 |
| 14 namespace gfx{ |
| 15 class Size; |
| 16 } |
| 17 |
| 18 namespace gpu { |
| 19 namespace gles2 { |
| 20 class GLES2Implementation; |
| 21 } // namespace gles2 |
| 22 } // namespace gpu |
| 23 |
| 24 namespace webkit { |
| 25 namespace ppapi { |
| 26 |
| 27 class PPB_Context3D_Impl : public Resource { |
| 28 public: |
| 29 explicit PPB_Context3D_Impl(PluginModule* module); |
| 30 virtual ~PPB_Context3D_Impl(); |
| 31 |
| 32 static const PPB_Context3D_Dev* GetInterface(); |
| 33 |
| 34 // Resource override. |
| 35 virtual PPB_Context3D_Impl* AsPPB_Context3D_Impl(); |
| 36 |
| 37 bool Init(PluginInstance* instance, |
| 38 PP_Config3D_Dev config, |
| 39 PP_Resource share_context, |
| 40 const int32_t* attrib_list); |
| 41 |
| 42 // Associates this PPB_Context3D_Impl with the given plugin instance. |
| 43 // You can pass NULL to clear the existing device. Returns true on success. |
| 44 // In this case, the last rendered frame is displayed. |
| 45 // |
| 46 // TODO(alokp): This is confusing. This context is already associated with |
| 47 // an instance. This function should rather be called BindToInstanceGraphics |
| 48 // or something similar which means from this point on, anything drawn with |
| 49 // this context appears on instance window. This function should also not |
| 50 // take any argument. But this means modifying PPB_Instance::BindGraphics. |
| 51 bool BindToInstance(PluginInstance* new_instance); |
| 52 |
| 53 bool SwapBuffers(); |
| 54 void SetSwapBuffersCallback(Callback0::Type* callback); |
| 55 |
| 56 unsigned int GetBackingTextureId(); |
| 57 void ResizeBackingTexture(const gfx::Size& size); |
| 58 |
| 59 gpu::gles2::GLES2Implementation* gles2_impl() { |
| 60 return gles2_impl_; |
| 61 } |
| 62 |
| 63 private: |
| 64 void Destroy(); |
| 65 |
| 66 // Non-owning pointer to the plugin instance this context is currently bound |
| 67 // to, if any. If the context is currently unbound, this will be NULL. |
| 68 PluginInstance* bound_instance_; |
| 69 |
| 70 // PluginDelegate's 3D Context. Responsible for providing the command buffer. |
| 71 scoped_ptr<PluginDelegate::PlatformContext3D> platform_context_; |
| 72 |
| 73 // GLES2 Implementation instance. Owned by the platform context's GGL context. |
| 74 gpu::gles2::GLES2Implementation* gles2_impl_; |
| 75 |
| 76 DISALLOW_COPY_AND_ASSIGN(PPB_Context3D_Impl); |
| 77 }; |
| 78 |
| 79 } // namespace ppapi |
| 80 } // namespace webkit |
| 81 |
| 82 #endif // WEBKIT_PLUGINS_PPAPI_PPB_CONTEXT_3D_IMPL_H_ |
OLD | NEW |