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

Unified Diff: ppapi/cpp/dev/graphics_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 10 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/cpp/dev/graphics_3d_dev.h ('k') | ppapi/cpp/instance.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/dev/graphics_3d_dev.cc
===================================================================
--- ppapi/cpp/dev/graphics_3d_dev.cc (revision 69970)
+++ ppapi/cpp/dev/graphics_3d_dev.cc (working copy)
@@ -4,11 +4,9 @@
#include "ppapi/cpp/dev/graphics_3d_dev.h"
-#include "ppapi/cpp/common.h"
-#include "ppapi/cpp/instance.h"
-#include "ppapi/cpp/resource.h"
-#include "ppapi/cpp/module.h"
+#include "ppapi/c/pp_errors.h"
#include "ppapi/cpp/module_impl.h"
+#include "ppapi/cpp/var.h"
namespace pp {
@@ -18,87 +16,37 @@
return PPB_GRAPHICS_3D_DEV_INTERFACE;
}
-template <> const char* interface_name<PPB_OpenGLES2_Dev>() {
- return PPB_OPENGLES2_DEV_INTERFACE;
-}
-
} // namespace
// static
-bool Graphics3D_Dev::GetConfigs(int32_t *configs, int32_t config_size,
- int32_t *num_config) {
- if (has_interface<PPB_Graphics3D_Dev>()) {
- return PPBoolToBool(get_interface<PPB_Graphics3D_Dev>()->GetConfigs(
- configs, config_size, num_config));
- }
- return false;
-}
+int32_t Graphics3D_Dev::GetConfigs(int32_t *configs,
+ int32_t config_size,
+ int32_t *num_config) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
-// static
-bool Graphics3D_Dev::ChooseConfig(const int32_t *attrib_list, int32_t *configs,
- int32_t config_size, int32_t *num_config) {
- if (has_interface<PPB_Graphics3D_Dev>()) {
- return PPBoolToBool(get_interface<PPB_Graphics3D_Dev>()->ChooseConfig(
- attrib_list, configs, config_size, num_config));
- }
- return false;
+ return get_interface<PPB_Graphics3D_Dev>()->GetConfigs(
+ configs, config_size, num_config);
}
// static
-bool Graphics3D_Dev::GetConfigAttrib(int32_t config, int32_t attribute,
- int32_t *value) {
- if (has_interface<PPB_Graphics3D_Dev>()) {
- return PPBoolToBool(get_interface<PPB_Graphics3D_Dev>()->GetConfigAttrib(
- config, attribute, value));
- }
- return false;
-}
+int32_t Graphics3D_Dev::GetConfigAttribs(PP_Config3D_Dev config,
+ int32_t* attrib_list) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
-// static
-const char* Graphics3D_Dev::QueryString(int32_t name) {
- if (has_interface<PPB_Graphics3D_Dev>())
- return get_interface<PPB_Graphics3D_Dev>()->QueryString(name);
- return NULL;
+ return get_interface<PPB_Graphics3D_Dev>()->GetConfigAttribs(
+ config, attrib_list);
}
// static
-void* Graphics3D_Dev::GetProcAddress(const char* name) {
- if (has_interface<PPB_Graphics3D_Dev>())
- return get_interface<PPB_Graphics3D_Dev>()->GetProcAddress(name);
- return NULL;
-}
+Var Graphics3D_Dev::GetString(int32_t name) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return Var();
-Graphics3D_Dev Graphics3D_Dev::FromResource(PP_Resource resource_id) {
- if (has_interface<PPB_Graphics3D_Dev>() &&
- get_interface<PPB_Graphics3D_Dev>()->IsGraphics3D(resource_id))
- return Graphics3D_Dev(resource_id);
- return Graphics3D_Dev();
+ return Var(Var::PassRef(),
+ get_interface<PPB_Graphics3D_Dev>()->GetString(name));
}
-uint32_t Graphics3D_Dev::GetError() {
- if (has_interface<PPB_Graphics3D_Dev>())
- return get_interface<PPB_Graphics3D_Dev>()->GetError();
- return PP_GRAPHICS_3D_ERROR_NOT_INITIALIZED;
-}
-
-const PPB_OpenGLES2_Dev* Graphics3D_Dev::GetImplementation() {
- return get_interface<PPB_OpenGLES2_Dev>();
-}
-
-Graphics3D_Dev::Graphics3D_Dev(const Instance& instance,
- int32_t config,
- int32_t share_context,
- const int32_t* attrib_list) {
- if (has_interface<PPB_Graphics3D_Dev>() &&
- has_interface<PPB_OpenGLES2_Dev>()) {
- PassRefFromConstructor(get_interface<PPB_Graphics3D_Dev>()->CreateContext(
- instance.pp_instance(), config, share_context, attrib_list));
- }
-}
-
-bool Graphics3D_Dev::SwapBuffers() const {
- return has_interface<PPB_Graphics3D_Dev>() &&
- get_interface<PPB_Graphics3D_Dev>()->SwapBuffers(pp_resource());
-}
-
} // namespace pp
+
« no previous file with comments | « ppapi/cpp/dev/graphics_3d_dev.h ('k') | ppapi/cpp/instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698