OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ppapi/c/pp_completion_callback.h" |
| 6 #include "ppapi/c/pp_errors.h" |
| 7 #include "ppapi/thunk/thunk.h" |
| 8 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_graphics_3d_api.h" |
| 10 #include "ppapi/thunk/resource_creation_api.h" |
| 11 |
| 12 namespace ppapi { |
| 13 namespace thunk { |
| 14 |
| 15 namespace { |
| 16 |
| 17 typedef EnterResource<PPB_Graphics3D_API> EnterGraphics3D; |
| 18 |
| 19 int32_t GetConfigs(PP_Config3D_Dev* configs, |
| 20 int32_t config_size, |
| 21 int32_t* num_config) { |
| 22 // TODO(alokp): Implement me. |
| 23 return PP_ERROR_FAILED; |
| 24 } |
| 25 |
| 26 int32_t GetConfigAttribs(PP_Config3D_Dev config, int32_t* attrib_list) { |
| 27 // TODO(alokp): Implement me. |
| 28 return PP_ERROR_FAILED; |
| 29 } |
| 30 |
| 31 PP_Var GetString(int32_t name) { |
| 32 // TODO(alokp): Implement me. |
| 33 return PP_MakeUndefined(); |
| 34 } |
| 35 |
| 36 PP_Resource Create(PP_Instance instance, |
| 37 PP_Config3D_Dev config, |
| 38 PP_Resource share_context, |
| 39 const int32_t* attrib_list) { |
| 40 EnterFunction<ResourceCreationAPI> enter(instance, true); |
| 41 if (enter.failed()) |
| 42 return 0; |
| 43 return enter.functions()->CreateGraphics3D(instance, config, share_context, |
| 44 attrib_list); |
| 45 } |
| 46 |
| 47 PP_Bool IsGraphics3D(PP_Resource resource) { |
| 48 EnterGraphics3D enter(resource, false); |
| 49 return PP_FromBool(enter.succeeded()); |
| 50 } |
| 51 |
| 52 int32_t GetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) { |
| 53 EnterGraphics3D enter(graphics_3d, true); |
| 54 if (enter.failed()) |
| 55 return PP_ERROR_BADRESOURCE; |
| 56 return enter.object()->GetAttribs(attrib_list); |
| 57 } |
| 58 |
| 59 int32_t SetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) { |
| 60 EnterGraphics3D enter(graphics_3d, true); |
| 61 if (enter.failed()) |
| 62 return PP_ERROR_BADRESOURCE; |
| 63 return enter.object()->SetAttribs(attrib_list); |
| 64 } |
| 65 |
| 66 int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) { |
| 67 EnterGraphics3D enter(graphics_3d, true); |
| 68 if (enter.failed()) |
| 69 return PP_ERROR_BADRESOURCE; |
| 70 return enter.object()->SwapBuffers(callback); |
| 71 } |
| 72 |
| 73 const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = { |
| 74 &GetConfigs, |
| 75 &GetConfigAttribs, |
| 76 &GetString, |
| 77 &Create, |
| 78 &IsGraphics3D, |
| 79 &GetAttribs, |
| 80 &SetAttribs, |
| 81 &SwapBuffers |
| 82 }; |
| 83 |
| 84 } // namespace |
| 85 |
| 86 const PPB_Graphics3D_Dev* GetPPB_Graphics3D_Thunk() { |
| 87 return &g_ppb_graphics_3d_thunk; |
| 88 } |
| 89 |
| 90 } // namespace thunk |
| 91 } // namespace ppapi |
OLD | NEW |