Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | 5 #ifndef PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ |
| 6 #define PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | 6 #define PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ppapi/c/pp_completion_callback.h" | 10 #include "ppapi/c/pp_completion_callback.h" |
| 11 #include "ppapi/shared_impl/ppapi_shared_export.h" | 11 #include "ppapi/shared_impl/ppapi_shared_export.h" |
| 12 #include "ppapi/thunk/ppb_graphics_3d_api.h" | 12 #include "ppapi/thunk/ppb_graphics_3d_api.h" |
| 13 | 13 |
| 14 namespace gpu { | 14 namespace gpu { |
| 15 class CommandBuffer; | 15 class CommandBuffer; |
| 16 namespace gles2 { | 16 namespace gles2 { |
| 17 class GLES2CmdHelper; | 17 class GLES2CmdHelper; |
| 18 class GLES2Implementation; | 18 class GLES2Implementation; |
| 19 } // namespace gles2 | 19 } // namespace gles2 |
| 20 } // namespace gpu. | 20 } // namespace gpu. |
| 21 | 21 |
| 22 namespace ppapi { | 22 namespace ppapi { |
| 23 | 23 |
| 24 class PPAPI_SHARED_EXPORT Graphics3DImpl : public thunk::PPB_Graphics3D_API { | 24 class PPAPI_SHARED_EXPORT PPB_Graphics3D_Shared |
| 25 : public thunk::PPB_Graphics3D_API { | |
|
yzshen1
2011/12/03 00:29:04
nit: wrong indent.
| |
| 25 public: | 26 public: |
| 26 // PPB_Graphics3D_API implementation. | 27 // PPB_Graphics3D_API implementation. |
| 27 virtual int32_t GetAttribs(int32_t* attrib_list) OVERRIDE; | 28 virtual int32_t GetAttribs(int32_t* attrib_list) OVERRIDE; |
| 28 virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE; | 29 virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE; |
| 29 virtual int32_t GetError() OVERRIDE; | 30 virtual int32_t GetError() OVERRIDE; |
| 30 virtual int32_t ResizeBuffers(int32_t width, int32_t height) OVERRIDE; | 31 virtual int32_t ResizeBuffers(int32_t width, int32_t height) OVERRIDE; |
| 31 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; | 32 virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE; |
| 32 virtual void* MapTexSubImage2DCHROMIUM(GLenum target, | 33 virtual void* MapTexSubImage2DCHROMIUM(GLenum target, |
| 33 GLint level, | 34 GLint level, |
| 34 GLint xoffset, | 35 GLint xoffset, |
| 35 GLint yoffset, | 36 GLint yoffset, |
| 36 GLsizei width, | 37 GLsizei width, |
| 37 GLsizei height, | 38 GLsizei height, |
| 38 GLenum format, | 39 GLenum format, |
| 39 GLenum type, | 40 GLenum type, |
| 40 GLenum access) OVERRIDE; | 41 GLenum access) OVERRIDE; |
| 41 virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; | 42 virtual void UnmapTexSubImage2DCHROMIUM(const void* mem) OVERRIDE; |
| 42 | 43 |
| 43 gpu::gles2::GLES2Implementation* gles2_impl() { | 44 gpu::gles2::GLES2Implementation* gles2_impl() { |
| 44 return gles2_impl_.get(); | 45 return gles2_impl_.get(); |
| 45 } | 46 } |
| 46 | 47 |
| 47 // Sends swap-buffers notification to the plugin. | 48 // Sends swap-buffers notification to the plugin. |
| 48 void SwapBuffersACK(int32_t pp_error); | 49 void SwapBuffersACK(int32_t pp_error); |
| 49 | 50 |
| 50 protected: | 51 protected: |
| 51 Graphics3DImpl(); | 52 PPB_Graphics3D_Shared(); |
| 52 virtual ~Graphics3DImpl(); | 53 virtual ~PPB_Graphics3D_Shared(); |
| 53 | 54 |
| 54 virtual gpu::CommandBuffer* GetCommandBuffer() = 0; | 55 virtual gpu::CommandBuffer* GetCommandBuffer() = 0; |
| 55 virtual int32 DoSwapBuffers() = 0; | 56 virtual int32 DoSwapBuffers() = 0; |
| 56 | 57 |
| 57 bool HasPendingSwap() { return swap_callback_.func != NULL; } | 58 bool HasPendingSwap() { return swap_callback_.func != NULL; } |
| 58 bool CreateGLES2Impl(int32 command_buffer_size, | 59 bool CreateGLES2Impl(int32 command_buffer_size, |
| 59 int32 transfer_buffer_size); | 60 int32 transfer_buffer_size); |
| 60 void DestroyGLES2Impl(); | 61 void DestroyGLES2Impl(); |
| 61 | 62 |
| 62 private: | 63 private: |
| 63 int32 transfer_buffer_id_; | 64 int32 transfer_buffer_id_; |
| 64 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; | 65 scoped_ptr<gpu::gles2::GLES2CmdHelper> gles2_helper_; |
| 65 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; | 66 scoped_ptr<gpu::gles2::GLES2Implementation> gles2_impl_; |
| 66 | 67 |
| 67 // Callback that needs to be executed when swap-buffers is completed. | 68 // Callback that needs to be executed when swap-buffers is completed. |
| 68 PP_CompletionCallback swap_callback_; | 69 PP_CompletionCallback swap_callback_; |
| 69 | 70 |
| 70 DISALLOW_COPY_AND_ASSIGN(Graphics3DImpl); | 71 DISALLOW_COPY_AND_ASSIGN(PPB_Graphics3D_Shared); |
| 71 }; | 72 }; |
| 72 | 73 |
| 73 } // namespace ppapi | 74 } // namespace ppapi |
| 74 | 75 |
| 75 #endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ | 76 #endif // PPAPI_SHARED_IMPL_GRAPHICS_3D_IMPL_H_ |
| 76 | 77 |
| OLD | NEW |