summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 16:35:41 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 16:35:41 +0000
commit05671a8a7551fc0f1e2d576a2b9bdea61f4167a2 (patch)
treeabb1756b935e22b29978722f9bf245784d18ef22 /ppapi
parent74f4b46ab44016f9e7ad56cde5916ffbc45723d3 (diff)
downloadchromium_src-05671a8a7551fc0f1e2d576a2b9bdea61f4167a2.zip
chromium_src-05671a8a7551fc0f1e2d576a2b9bdea61f4167a2.tar.gz
chromium_src-05671a8a7551fc0f1e2d576a2b9bdea61f4167a2.tar.bz2
Implemented cpp interface for PPB_Graphics3D_Dev. Needed to port gpu demos.
TBR=piman Review URL: http://codereview.chromium.org/6816028 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/cpp/dev/graphics_3d_dev.cc50
-rw-r--r--ppapi/cpp/dev/graphics_3d_dev.h22
2 files changed, 69 insertions, 3 deletions
diff --git a/ppapi/cpp/dev/graphics_3d_dev.cc b/ppapi/cpp/dev/graphics_3d_dev.cc
index f0a587e..021669f 100644
--- a/ppapi/cpp/dev/graphics_3d_dev.cc
+++ b/ppapi/cpp/dev/graphics_3d_dev.cc
@@ -1,10 +1,12 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ppapi/cpp/dev/graphics_3d_dev.h"
#include "ppapi/c/pp_errors.h"
+#include "ppapi/cpp/completion_callback.h"
+#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/module_impl.h"
#include "ppapi/cpp/var.h"
@@ -18,6 +20,25 @@ template <> const char* interface_name<PPB_Graphics3D_Dev>() {
} // namespace
+Graphics3D_Dev::Graphics3D_Dev() {
+}
+
+Graphics3D_Dev::Graphics3D_Dev(const Instance& instance,
+ PP_Config3D_Dev config,
+ const Graphics3D_Dev& share_context,
+ const int32_t* attrib_list) {
+ if (has_interface<PPB_Graphics3D_Dev>()) {
+ PassRefFromConstructor(get_interface<PPB_Graphics3D_Dev>()->Create(
+ instance.pp_instance(),
+ config,
+ share_context.pp_resource(),
+ attrib_list));
+ }
+}
+
+Graphics3D_Dev::~Graphics3D_Dev() {
+}
+
// static
int32_t Graphics3D_Dev::GetConfigs(int32_t *configs,
int32_t config_size,
@@ -48,5 +69,32 @@ Var Graphics3D_Dev::GetString(int32_t name) {
get_interface<PPB_Graphics3D_Dev>()->GetString(name));
}
+int32_t Graphics3D_Dev::GetAttribs(int32_t* attrib_list) const {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
+
+ return get_interface<PPB_Graphics3D_Dev>()->GetAttribs(
+ pp_resource(),
+ attrib_list);
+}
+
+int32_t Graphics3D_Dev::SetAttribs(int32_t* attrib_list) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
+
+ return get_interface<PPB_Graphics3D_Dev>()->SetAttribs(
+ pp_resource(),
+ attrib_list);
+}
+
+int32_t Graphics3D_Dev::SwapBuffers(const CompletionCallback& cc) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
+
+ return get_interface<PPB_Graphics3D_Dev>()->SwapBuffers(
+ pp_resource(),
+ cc.pp_completion_callback());
+}
+
} // namespace pp
diff --git a/ppapi/cpp/dev/graphics_3d_dev.h b/ppapi/cpp/dev/graphics_3d_dev.h
index dece4c0..0b967ad 100644
--- a/ppapi/cpp/dev/graphics_3d_dev.h
+++ b/ppapi/cpp/dev/graphics_3d_dev.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,13 +6,26 @@
#define PPAPI_CPP_DEV_GRAPHICS_3D_DEV_H_
#include "ppapi/c/dev/ppb_graphics_3d_dev.h"
+#include "ppapi/cpp/resource.h"
namespace pp {
+class CompletionCallback;
+class Instance;
class Var;
-class Graphics3D_Dev {
+class Graphics3D_Dev : public Resource {
public:
+ // Creates an is_null() Graphics3D_Dev object.
+ Graphics3D_Dev();
+
+ Graphics3D_Dev(const Instance& instance,
+ PP_Config3D_Dev config,
+ const Graphics3D_Dev& share_context,
+ const int32_t* attrib_list);
+
+ ~Graphics3D_Dev();
+
static int32_t GetConfigs(PP_Config3D_Dev* configs,
int32_t config_size,
int32_t* num_config);
@@ -21,6 +34,11 @@ class Graphics3D_Dev {
int32_t* attrib_list);
static Var GetString(int32_t name);
+
+ int32_t GetAttribs(int32_t* attrib_list) const;
+ int32_t SetAttribs(int32_t* attrib_list);
+
+ int32_t SwapBuffers(const CompletionCallback& cc);
};
} // namespace pp