Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(544)

Side by Side Diff: ppapi/cpp/dev/context_3d_dev.cc

Issue 6062003: Added ppapi::Context3D interface. The API has already been reviewed. I am add... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/dev/context_3d_dev.h ('k') | ppapi/cpp/dev/graphics_3d_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(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_completion_callback.h"
8 #include "ppapi/c/dev/ppb_opengles_dev.h"
9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/cpp/instance.h"
11 #include "ppapi/cpp/module_impl.h"
12
13 namespace pp {
14
15 namespace {
16
17 template <> const char* interface_name<PPB_Context3D_Dev>() {
18 return PPB_CONTEXT_3D_DEV_INTERFACE;
19 }
20
21 template <> const char* interface_name<PPB_OpenGLES2_Dev>() {
22 return PPB_OPENGLES2_DEV_INTERFACE;
23 }
24
25 } // namespace
26
27 Context3D_Dev Context3D_Dev::FromResource(PP_Resource resource_id) {
28 if (has_interface<PPB_Context3D_Dev>() &&
29 get_interface<PPB_Context3D_Dev>()->IsContext3D(resource_id))
30 return Context3D_Dev(resource_id);
31
32 return Context3D_Dev();
33 }
34
35 Context3D_Dev::Context3D_Dev(const Instance& instance,
36 PP_Config3D_Dev config,
37 const Context3D_Dev& share_context,
38 const int32_t* attrib_list) {
39 if (has_interface<PPB_Context3D_Dev>() &&
40 has_interface<PPB_OpenGLES2_Dev>()) {
41 PassRefFromConstructor(get_interface<PPB_Context3D_Dev>()->Create(
42 instance.pp_instance(),
43 config,
44 share_context.pp_resource(),
45 attrib_list));
46 }
47 }
48
49 int32_t Context3D_Dev::SwapBuffers() const {
50 if (!has_interface<PPB_Context3D_Dev>())
51 return PP_ERROR_NOINTERFACE;
52
53 return get_interface<PPB_Context3D_Dev>()->SwapBuffers(
54 pp_resource(),
55 PP_BlockUntilComplete());
56 }
57
58 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/cpp/dev/context_3d_dev.h ('k') | ppapi/cpp/dev/graphics_3d_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698