summaryrefslogtreecommitdiffstats
path: root/ppapi/cpp
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-21 17:12:55 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-21 17:12:55 +0000
commit3e9d8aa0bbf6e2ed8d093e17c92cacff383c7e4f (patch)
treeab4483673b5886ee5b821bccb8ecbee2c5922ffd /ppapi/cpp
parente5b826e46e8a435945f94370bd50bc7ee1749607 (diff)
downloadchromium_src-3e9d8aa0bbf6e2ed8d093e17c92cacff383c7e4f.zip
chromium_src-3e9d8aa0bbf6e2ed8d093e17c92cacff383c7e4f.tar.gz
chromium_src-3e9d8aa0bbf6e2ed8d093e17c92cacff383c7e4f.tar.bz2
Moved the logic of maintaining the current context to gles2 helper library.
Review URL: http://codereview.chromium.org/5927002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69838 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/cpp')
-rw-r--r--ppapi/cpp/dev/graphics_3d_dev.cc38
-rw-r--r--ppapi/cpp/dev/graphics_3d_dev.h5
2 files changed, 6 insertions, 37 deletions
diff --git a/ppapi/cpp/dev/graphics_3d_dev.cc b/ppapi/cpp/dev/graphics_3d_dev.cc
index 8f03697..579b610 100644
--- a/ppapi/cpp/dev/graphics_3d_dev.cc
+++ b/ppapi/cpp/dev/graphics_3d_dev.cc
@@ -10,10 +10,6 @@
#include "ppapi/cpp/module.h"
#include "ppapi/cpp/module_impl.h"
-extern "C" {
-const PPB_OpenGLES_Dev* pepper_opengl_interface = NULL;
-}
-
namespace pp {
namespace {
@@ -22,13 +18,8 @@ template <> const char* interface_name<PPB_Graphics3D_Dev>() {
return PPB_GRAPHICS_3D_DEV_INTERFACE;
}
-template <> const char* interface_name<PPB_OpenGLES_Dev>() {
- return PPB_OPENGLES_DEV_INTERFACE;
-}
-
-inline void InitializeOpenGLCInterface() {
- if (!pepper_opengl_interface)
- pepper_opengl_interface = get_interface<PPB_OpenGLES_Dev>();
+template <> const char* interface_name<PPB_OpenGLES2_Dev>() {
+ return PPB_OPENGLES2_DEV_INTERFACE;
}
} // namespace
@@ -84,26 +75,14 @@ Graphics3D_Dev Graphics3D_Dev::FromResource(PP_Resource resource_id) {
return Graphics3D_Dev();
}
-bool Graphics3D_Dev::ResetCurrent() {
- return has_interface<PPB_Graphics3D_Dev>() &&
- get_interface<PPB_Graphics3D_Dev>()->MakeCurent(0);
-}
-
-Graphics3D_Dev Graphics3D_Dev::GetCurrentContext() {
- if (has_interface<PPB_Graphics3D_Dev>())
- return FromResource(
- get_interface<PPB_Graphics3D_Dev>()->GetCurrentContext());
- return Graphics3D_Dev();
-}
-
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_OpenGLES_Dev* Graphics3D_Dev::GetImplementation() {
- return get_interface<PPB_OpenGLES_Dev>();
+const PPB_OpenGLES2_Dev* Graphics3D_Dev::GetImplementation() {
+ return get_interface<PPB_OpenGLES2_Dev>();
}
Graphics3D_Dev::Graphics3D_Dev(const Instance& instance,
@@ -111,19 +90,12 @@ Graphics3D_Dev::Graphics3D_Dev(const Instance& instance,
int32_t share_context,
const int32_t* attrib_list) {
if (has_interface<PPB_Graphics3D_Dev>() &&
- has_interface<PPB_OpenGLES_Dev>()) {
- InitializeOpenGLCInterface();
+ has_interface<PPB_OpenGLES2_Dev>()) {
PassRefFromConstructor(get_interface<PPB_Graphics3D_Dev>()->CreateContext(
instance.pp_instance(), config, share_context, attrib_list));
}
}
-bool Graphics3D_Dev::MakeCurrent() const {
- InitializeOpenGLCInterface();
- return has_interface<PPB_Graphics3D_Dev>() &&
- get_interface<PPB_Graphics3D_Dev>()->MakeCurent(pp_resource());
-}
-
bool Graphics3D_Dev::SwapBuffers() const {
return has_interface<PPB_Graphics3D_Dev>() &&
get_interface<PPB_Graphics3D_Dev>()->SwapBuffers(pp_resource());
diff --git a/ppapi/cpp/dev/graphics_3d_dev.h b/ppapi/cpp/dev/graphics_3d_dev.h
index 88fe47d..43bd0b0 100644
--- a/ppapi/cpp/dev/graphics_3d_dev.h
+++ b/ppapi/cpp/dev/graphics_3d_dev.h
@@ -27,10 +27,8 @@ class Graphics3D_Dev : public Resource {
static void* GetProcAddress(const char* name);
- static bool ResetCurrent();
- static Graphics3D_Dev GetCurrentContext();
static uint32_t GetError();
- static const PPB_OpenGLES_Dev* GetImplementation();
+ static const PPB_OpenGLES2_Dev* GetImplementation();
// Creates an is_null() Graphics3D object.
Graphics3D_Dev() {}
@@ -40,7 +38,6 @@ class Graphics3D_Dev : public Resource {
int32_t share_context,
const int32_t* attrib_list);
- bool MakeCurrent() const;
bool SwapBuffers() const;
protected: