| 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 #include "ppapi/cpp/dev/context_3d_dev.h" | |
| 6 | |
| 7 #include "ppapi/c/pp_errors.h" | |
| 8 #include "ppapi/cpp/dev/surface_3d_dev.h" | |
| 9 #include "ppapi/cpp/instance.h" | |
| 10 #include "ppapi/cpp/module_impl.h" | |
| 11 | |
| 12 namespace pp { | |
| 13 | |
| 14 namespace { | |
| 15 | |
| 16 template <> const char* interface_name<PPB_Context3D_Dev>() { | |
| 17 return PPB_CONTEXT_3D_DEV_INTERFACE; | |
| 18 } | |
| 19 | |
| 20 } // namespace | |
| 21 | |
| 22 Context3D_Dev Context3D_Dev::FromResource(PP_Resource resource_id) { | |
| 23 if (has_interface<PPB_Context3D_Dev>() && | |
| 24 get_interface<PPB_Context3D_Dev>()->IsContext3D(resource_id)) | |
| 25 return Context3D_Dev(resource_id); | |
| 26 | |
| 27 return Context3D_Dev(); | |
| 28 } | |
| 29 | |
| 30 Context3D_Dev::Context3D_Dev(const Instance& instance, | |
| 31 PP_Config3D_Dev config, | |
| 32 const Context3D_Dev& share_context, | |
| 33 const int32_t* attrib_list) { | |
| 34 if (has_interface<PPB_Context3D_Dev>()) { | |
| 35 PassRefFromConstructor(get_interface<PPB_Context3D_Dev>()->Create( | |
| 36 instance.pp_instance(), | |
| 37 config, | |
| 38 share_context.pp_resource(), | |
| 39 attrib_list)); | |
| 40 } | |
| 41 } | |
| 42 | |
| 43 int32_t Context3D_Dev::BindSurfaces(const Surface3D_Dev& draw, | |
| 44 const Surface3D_Dev& read) { | |
| 45 if (!has_interface<PPB_Context3D_Dev>()) | |
| 46 return PP_ERROR_NOINTERFACE; | |
| 47 | |
| 48 return get_interface<PPB_Context3D_Dev>()->BindSurfaces( | |
| 49 pp_resource(), draw.pp_resource(), read.pp_resource()); | |
| 50 } | |
| 51 | |
| 52 } // namespace pp | |
| OLD | NEW |