diff options
author | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-17 03:47:18 +0000 |
---|---|---|
committer | piman@google.com <piman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-17 03:47:18 +0000 |
commit | bf802a7a32cbd53466c30773498fa6c3674688ea (patch) | |
tree | 3b41a578a4a792e5cc188dcc0134d7e9225f9a46 /ppapi | |
parent | 094b705690bf7e9d7bf787e6c4a88efc92d2cdd1 (diff) | |
download | chromium_src-bf802a7a32cbd53466c30773498fa6c3674688ea.zip chromium_src-bf802a7a32cbd53466c30773498fa6c3674688ea.tar.gz chromium_src-bf802a7a32cbd53466c30773498fa6c3674688ea.tar.bz2 |
Make Graphics3D::SwapBuffers take a completion callback
BUG=none
TEST=with pepper flash, rate control works
Review URL: http://codereview.chromium.org/5944001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69511 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/c/dev/ppb_graphics_3d_dev.h | 11 | ||||
-rw-r--r-- | ppapi/cpp/dev/graphics_3d_dev.cc | 5 | ||||
-rw-r--r-- | ppapi/cpp/dev/graphics_3d_dev.h | 3 |
3 files changed, 13 insertions, 6 deletions
diff --git a/ppapi/c/dev/ppb_graphics_3d_dev.h b/ppapi/c/dev/ppb_graphics_3d_dev.h index 7bd739b..eb8c150 100644 --- a/ppapi/c/dev/ppb_graphics_3d_dev.h +++ b/ppapi/c/dev/ppb_graphics_3d_dev.h @@ -6,6 +6,7 @@ #define PPAPI_C_DEV_PPB_GRAPHICS_3D_DEV_H_ #include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" #include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_module.h" #include "ppapi/c/pp_resource.h" @@ -20,12 +21,12 @@ // CHECK(device->MakeCurrent(context)); // glClear(GL_COLOR_BUFFER); // CHECK(device->MakeCurrent(NULL)); -// CHECK(device->SwapBuffers(context)); +// CHECK(device->SwapBuffers(context, callback)); // // // Shutdown. // core->ReleaseResource(context); -#define PPB_GRAPHICS_3D_DEV_INTERFACE "PPB_Graphics3D(Dev);0.3" +#define PPB_GRAPHICS_3D_DEV_INTERFACE "PPB_Graphics3D(Dev);0.4" // These are the same error codes as used by EGL. enum { @@ -89,11 +90,15 @@ struct PPB_Graphics3D_Dev { // Snapshots the rendered frame and makes it available for composition with // the rest of the page. The alpha channel is used for translucency effects. // One means fully opaque. Zero means fully transparent. Any thread. + // The callback will be called when SwapBuffers completes. While a SwapBuffers + // call is pending, all subsequent SwapBuffers calls will fail. Specifying a + // NULL callback means blocking but this is not legal on the main thread. // TODO(apatrick): premultiplied alpha or linear alpha? Premultiplied alpha is // better for correct alpha blending effect. Most existing OpenGL code assumes // linear. I could convert from linear to premultiplied during the copy from // back-buffer to offscreen "front-buffer". - PP_Bool (*SwapBuffers)(PP_Resource context); + PP_Bool (*SwapBuffers)(PP_Resource context, + struct PP_CompletionCallback callback); // Returns the current error for this thread. This is not associated with a // particular context. It is distinct from the GL error returned by diff --git a/ppapi/cpp/dev/graphics_3d_dev.cc b/ppapi/cpp/dev/graphics_3d_dev.cc index a15417c..b1fa037 100644 --- a/ppapi/cpp/dev/graphics_3d_dev.cc +++ b/ppapi/cpp/dev/graphics_3d_dev.cc @@ -119,8 +119,9 @@ bool Graphics3D_Dev::MakeCurrent() const { return graphics_3d_f && graphics_3d_f->MakeCurent(pp_resource()); } -bool Graphics3D_Dev::SwapBuffers() const { - return graphics_3d_f && graphics_3d_f->SwapBuffers(pp_resource()); +bool Graphics3D_Dev::SwapBuffers(const CompletionCallback& cc) const { + return graphics_3d_f && graphics_3d_f->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 88fe47d..ac9406b 100644 --- a/ppapi/cpp/dev/graphics_3d_dev.h +++ b/ppapi/cpp/dev/graphics_3d_dev.h @@ -7,6 +7,7 @@ #include "ppapi/c/dev/ppb_graphics_3d_dev.h" #include "ppapi/c/dev/ppb_opengles_dev.h" +#include "ppapi/cpp/completion_callback.h" #include "ppapi/cpp/instance.h" #include "ppapi/cpp/resource.h" @@ -41,7 +42,7 @@ class Graphics3D_Dev : public Resource { const int32_t* attrib_list); bool MakeCurrent() const; - bool SwapBuffers() const; + bool SwapBuffers(const CompletionCallback& cc) const; protected: explicit Graphics3D_Dev(PP_Resource resource_id) : Resource(resource_id) {} |