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/cpp/dev/surface_3d_dev.h" | |
6 | |
7 #include "ppapi/c/pp_completion_callback.h" | |
8 #include "ppapi/c/pp_errors.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_Surface3D_Dev>() { | |
17 return PPB_SURFACE_3D_DEV_INTERFACE; | |
18 } | |
19 | |
20 } // namespace | |
21 | |
22 Surface3D_Dev Surface3D_Dev::FromResource(PP_Resource resource_id) { | |
23 if (has_interface<PPB_Surface3D_Dev>() && | |
24 get_interface<PPB_Surface3D_Dev>()->IsSurface3D(resource_id)) | |
25 return Surface3D_Dev(resource_id); | |
26 | |
27 return Surface3D_Dev(); | |
28 } | |
29 | |
30 Surface3D_Dev::Surface3D_Dev(const Instance& instance, | |
31 PP_Config3D_Dev config, | |
32 const int32_t* attrib_list) { | |
33 if (has_interface<PPB_Surface3D_Dev>()) { | |
34 PassRefFromConstructor(get_interface<PPB_Surface3D_Dev>()->Create( | |
35 instance.pp_instance(), | |
36 config, | |
37 attrib_list)); | |
38 } | |
39 } | |
40 | |
41 int32_t Surface3D_Dev::SwapBuffers(const CompletionCallback& cc) const { | |
42 if (!has_interface<PPB_Surface3D_Dev>()) | |
43 return cc.MayForce(PP_ERROR_NOINTERFACE); | |
44 | |
45 return get_interface<PPB_Surface3D_Dev>()->SwapBuffers( | |
46 pp_resource(), | |
47 cc.pp_completion_callback()); | |
48 } | |
49 | |
50 } // namespace pp | |
OLD | NEW |