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/graphics_3d.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>() { |
18 return PPB_GRAPHICS_3D_DEV_INTERFACE; | 18 return PPB_GRAPHICS_3D_INTERFACE; |
19 } | 19 } |
20 | 20 |
21 } // namespace | 21 } // namespace |
22 | 22 |
23 Graphics3D_Dev::Graphics3D_Dev() { | 23 Graphics3D::Graphics3D() { |
24 } | 24 } |
25 | 25 |
26 Graphics3D_Dev::Graphics3D_Dev(const Instance& instance, | 26 Graphics3D::Graphics3D(const Instance& instance, |
27 const Graphics3D_Dev& share_context, | 27 const Graphics3D& share_context, |
28 const int32_t* attrib_list) { | 28 const int32_t* attrib_list) { |
29 if (has_interface<PPB_Graphics3D_Dev>()) { | 29 if (has_interface<PPB_Graphics3D>()) { |
30 PassRefFromConstructor(get_interface<PPB_Graphics3D_Dev>()->Create( | 30 PassRefFromConstructor(get_interface<PPB_Graphics3D>()->Create( |
31 instance.pp_instance(), | 31 instance.pp_instance(), |
32 share_context.pp_resource(), | 32 share_context.pp_resource(), |
33 attrib_list)); | 33 attrib_list)); |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 Graphics3D_Dev::~Graphics3D_Dev() { | 37 Graphics3D::~Graphics3D() { |
38 } | 38 } |
39 | 39 |
40 int32_t Graphics3D_Dev::GetAttribs(int32_t* attrib_list) const { | 40 int32_t Graphics3D::GetAttribs(int32_t* attrib_list) const { |
41 if (!has_interface<PPB_Graphics3D_Dev>()) | 41 if (!has_interface<PPB_Graphics3D>()) |
42 return PP_ERROR_NOINTERFACE; | 42 return PP_ERROR_NOINTERFACE; |
43 | 43 |
44 return get_interface<PPB_Graphics3D_Dev>()->GetAttribs( | 44 return get_interface<PPB_Graphics3D>()->GetAttribs( |
45 pp_resource(), | 45 pp_resource(), |
46 attrib_list); | 46 attrib_list); |
47 } | 47 } |
48 | 48 |
49 int32_t Graphics3D_Dev::SetAttribs(int32_t* attrib_list) { | 49 int32_t Graphics3D::SetAttribs(int32_t* attrib_list) { |
50 if (!has_interface<PPB_Graphics3D_Dev>()) | 50 if (!has_interface<PPB_Graphics3D>()) |
51 return PP_ERROR_NOINTERFACE; | 51 return PP_ERROR_NOINTERFACE; |
52 | 52 |
53 return get_interface<PPB_Graphics3D_Dev>()->SetAttribs( | 53 return get_interface<PPB_Graphics3D>()->SetAttribs( |
54 pp_resource(), | 54 pp_resource(), |
55 attrib_list); | 55 attrib_list); |
56 } | 56 } |
57 | 57 |
58 int32_t Graphics3D_Dev::ResizeBuffers(int32_t width, int32_t height) { | 58 int32_t Graphics3D::ResizeBuffers(int32_t width, int32_t height) { |
59 if (!has_interface<PPB_Graphics3D_Dev>()) | 59 if (!has_interface<PPB_Graphics3D>()) |
60 return PP_ERROR_NOINTERFACE; | 60 return PP_ERROR_NOINTERFACE; |
61 | 61 |
62 return get_interface<PPB_Graphics3D_Dev>()->ResizeBuffers( | 62 return get_interface<PPB_Graphics3D>()->ResizeBuffers( |
63 pp_resource(), width, height); | 63 pp_resource(), width, height); |
64 } | 64 } |
65 | 65 |
66 int32_t Graphics3D_Dev::SwapBuffers(const CompletionCallback& cc) { | 66 int32_t Graphics3D::SwapBuffers(const CompletionCallback& cc) { |
67 if (!has_interface<PPB_Graphics3D_Dev>()) | 67 if (!has_interface<PPB_Graphics3D>()) |
68 return PP_ERROR_NOINTERFACE; | 68 return PP_ERROR_NOINTERFACE; |
69 | 69 |
70 return get_interface<PPB_Graphics3D_Dev>()->SwapBuffers( | 70 return get_interface<PPB_Graphics3D>()->SwapBuffers( |
71 pp_resource(), | 71 pp_resource(), |
72 cc.pp_completion_callback()); | 72 cc.pp_completion_callback()); |
73 } | 73 } |
74 | 74 |
75 } // namespace pp | 75 } // namespace pp |
76 | 76 |
OLD | NEW |