| 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 #include "ppapi/cpp/dev/graphics_3d_dev.h" | 5 #include "ppapi/cpp/dev/graphics_3d_dev.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/cpp/completion_callback.h" | 8 #include "ppapi/cpp/completion_callback.h" |
| 9 #include "ppapi/cpp/instance.h" | 9 #include "ppapi/cpp/instance.h" |
| 10 #include "ppapi/cpp/module_impl.h" | 10 #include "ppapi/cpp/module_impl.h" |
| 11 #include "ppapi/cpp/var.h" | 11 #include "ppapi/cpp/var.h" |
| 12 | 12 |
| 13 namespace pp { | 13 namespace pp { |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 template <> const char* interface_name<PPB_Graphics3D_Dev>() { | 17 template <> const char* interface_name<PPB_Graphics3D_Dev>() { |
| 18 return PPB_GRAPHICS_3D_DEV_INTERFACE; | 18 return PPB_GRAPHICS_3D_DEV_INTERFACE; |
| 19 } | 19 } |
| 20 | 20 |
| 21 } // namespace | 21 } // namespace |
| 22 | 22 |
| 23 Graphics3D_Dev::Graphics3D_Dev() { | 23 Graphics3D_Dev::Graphics3D_Dev() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 Graphics3D_Dev::Graphics3D_Dev(const Instance& instance, | 26 Graphics3D_Dev::Graphics3D_Dev(const Instance& instance, |
| 27 PP_Config3D_Dev config, | |
| 28 const Graphics3D_Dev& share_context, | 27 const Graphics3D_Dev& share_context, |
| 29 const int32_t* attrib_list) { | 28 const int32_t* attrib_list) { |
| 30 if (has_interface<PPB_Graphics3D_Dev>()) { | 29 if (has_interface<PPB_Graphics3D_Dev>()) { |
| 31 PassRefFromConstructor(get_interface<PPB_Graphics3D_Dev>()->Create( | 30 PassRefFromConstructor(get_interface<PPB_Graphics3D_Dev>()->Create( |
| 32 instance.pp_instance(), | 31 instance.pp_instance(), |
| 33 config, | |
| 34 share_context.pp_resource(), | 32 share_context.pp_resource(), |
| 35 attrib_list)); | 33 attrib_list)); |
| 36 } | 34 } |
| 37 } | 35 } |
| 38 | 36 |
| 39 Graphics3D_Dev::~Graphics3D_Dev() { | 37 Graphics3D_Dev::~Graphics3D_Dev() { |
| 40 } | 38 } |
| 41 | 39 |
| 42 // static | 40 // static |
| 43 int32_t Graphics3D_Dev::GetConfigs(int32_t *configs, | |
| 44 int32_t config_size, | |
| 45 int32_t *num_config) { | |
| 46 if (!has_interface<PPB_Graphics3D_Dev>()) | |
| 47 return PP_ERROR_NOINTERFACE; | |
| 48 | |
| 49 return get_interface<PPB_Graphics3D_Dev>()->GetConfigs( | |
| 50 configs, config_size, num_config); | |
| 51 } | |
| 52 | |
| 53 // static | |
| 54 int32_t Graphics3D_Dev::GetConfigAttribs(PP_Config3D_Dev config, | |
| 55 int32_t* attrib_list) { | |
| 56 if (!has_interface<PPB_Graphics3D_Dev>()) | |
| 57 return PP_ERROR_NOINTERFACE; | |
| 58 | |
| 59 return get_interface<PPB_Graphics3D_Dev>()->GetConfigAttribs( | |
| 60 config, attrib_list); | |
| 61 } | |
| 62 | |
| 63 // static | |
| 64 Var Graphics3D_Dev::GetString(int32_t name) { | 41 Var Graphics3D_Dev::GetString(int32_t name) { |
| 65 if (!has_interface<PPB_Graphics3D_Dev>()) | 42 if (!has_interface<PPB_Graphics3D_Dev>()) |
| 66 return Var(); | 43 return Var(); |
| 67 | 44 |
| 68 return Var(Var::PassRef(), | 45 return Var(Var::PassRef(), |
| 69 get_interface<PPB_Graphics3D_Dev>()->GetString(name)); | 46 get_interface<PPB_Graphics3D_Dev>()->GetString(name)); |
| 70 } | 47 } |
| 71 | 48 |
| 72 int32_t Graphics3D_Dev::GetAttribs(int32_t* attrib_list) const { | 49 int32_t Graphics3D_Dev::GetAttribs(int32_t* attrib_list) const { |
| 73 if (!has_interface<PPB_Graphics3D_Dev>()) | 50 if (!has_interface<PPB_Graphics3D_Dev>()) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 99 if (!has_interface<PPB_Graphics3D_Dev>()) | 76 if (!has_interface<PPB_Graphics3D_Dev>()) |
| 100 return PP_ERROR_NOINTERFACE; | 77 return PP_ERROR_NOINTERFACE; |
| 101 | 78 |
| 102 return get_interface<PPB_Graphics3D_Dev>()->SwapBuffers( | 79 return get_interface<PPB_Graphics3D_Dev>()->SwapBuffers( |
| 103 pp_resource(), | 80 pp_resource(), |
| 104 cc.pp_completion_callback()); | 81 cc.pp_completion_callback()); |
| 105 } | 82 } |
| 106 | 83 |
| 107 } // namespace pp | 84 } // namespace pp |
| 108 | 85 |
| OLD | NEW |