summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-01 17:48:07 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-01 17:48:07 +0000
commit23bd2afd6cc61d9efe90addd84332280eaa13a7f (patch)
tree9790454a87b2ff16034eff20783d7f67e0aa47b0 /ppapi
parentfa76b46928cdc24202f8e91adc957abf24059627 (diff)
downloadchromium_src-23bd2afd6cc61d9efe90addd84332280eaa13a7f.zip
chromium_src-23bd2afd6cc61d9efe90addd84332280eaa13a7f.tar.gz
chromium_src-23bd2afd6cc61d9efe90addd84332280eaa13a7f.tar.bz2
Added PPB_Graphics3D_Dev::Resize to let plugins resize the backing surface.
BUG=62383 Review URL: http://codereview.chromium.org/7530010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94930 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/c/dev/ppb_graphics_3d_dev.h16
-rw-r--r--ppapi/cpp/dev/graphics_3d_dev.cc8
-rw-r--r--ppapi/cpp/dev/graphics_3d_dev.h2
-rw-r--r--ppapi/shared_impl/graphics_3d_impl.cc9
-rw-r--r--ppapi/shared_impl/graphics_3d_impl.h1
-rw-r--r--ppapi/thunk/ppb_graphics_3d_api.h1
-rw-r--r--ppapi/thunk/ppb_graphics_3d_thunk.cc8
7 files changed, 43 insertions, 2 deletions
diff --git a/ppapi/c/dev/ppb_graphics_3d_dev.h b/ppapi/c/dev/ppb_graphics_3d_dev.h
index 6e53328..dfcf566 100644
--- a/ppapi/c/dev/ppb_graphics_3d_dev.h
+++ b/ppapi/c/dev/ppb_graphics_3d_dev.h
@@ -31,8 +31,8 @@
// // Shutdown.
// core->ReleaseResource(context);
-#define PPB_GRAPHICS_3D_DEV_INTERFACE_0_5 "PPB_Graphics3D(Dev);0.5"
-#define PPB_GRAPHICS_3D_DEV_INTERFACE PPB_GRAPHICS_3D_DEV_INTERFACE_0_5
+#define PPB_GRAPHICS_3D_DEV_INTERFACE_0_6 "PPB_Graphics3D(Dev);0.6"
+#define PPB_GRAPHICS_3D_DEV_INTERFACE PPB_GRAPHICS_3D_DEV_INTERFACE_0_6
struct PPB_Graphics3D_Dev {
// TODO(alokp): Do these functions need module argument?
@@ -196,6 +196,18 @@ struct PPB_Graphics3D_Dev {
int32_t (*SetAttribs)(PP_Resource context,
int32_t* attrib_list);
+ // Resizes the backing surface for context.
+ //
+ // On failure the following error codes may be returned:
+ // - PP_ERROR_BADRESOURCE if context is invalid.
+ // - PP_ERROR_BADARGUMENT if the value specified for width or height
+ // is less than zero.
+ //
+ // If the surface could not be resized due to insufficient resources,
+ // PP_ERROR_NOMEMORY error is returned on the next SwapBuffers callback.
+ int32_t (*ResizeBuffers)(PP_Resource context,
+ int32_t width, int32_t height);
+
// Makes the contents of the color buffer available for compositing.
// This function has no effect on off-screen surfaces - ones not bound
// to any plugin instance. The contents of ancillary buffers are always
diff --git a/ppapi/cpp/dev/graphics_3d_dev.cc b/ppapi/cpp/dev/graphics_3d_dev.cc
index 021669f..3e6736f 100644
--- a/ppapi/cpp/dev/graphics_3d_dev.cc
+++ b/ppapi/cpp/dev/graphics_3d_dev.cc
@@ -87,6 +87,14 @@ int32_t Graphics3D_Dev::SetAttribs(int32_t* attrib_list) {
attrib_list);
}
+int32_t Graphics3D_Dev::ResizeBuffers(int32_t width, int32_t height) {
+ if (!has_interface<PPB_Graphics3D_Dev>())
+ return PP_ERROR_NOINTERFACE;
+
+ return get_interface<PPB_Graphics3D_Dev>()->ResizeBuffers(
+ pp_resource(), width, height);
+}
+
int32_t Graphics3D_Dev::SwapBuffers(const CompletionCallback& cc) {
if (!has_interface<PPB_Graphics3D_Dev>())
return PP_ERROR_NOINTERFACE;
diff --git a/ppapi/cpp/dev/graphics_3d_dev.h b/ppapi/cpp/dev/graphics_3d_dev.h
index 0b967ad..6961c78 100644
--- a/ppapi/cpp/dev/graphics_3d_dev.h
+++ b/ppapi/cpp/dev/graphics_3d_dev.h
@@ -38,6 +38,8 @@ class Graphics3D_Dev : public Resource {
int32_t GetAttribs(int32_t* attrib_list) const;
int32_t SetAttribs(int32_t* attrib_list);
+ int32_t ResizeBuffers(int32_t width, int32_t height);
+
int32_t SwapBuffers(const CompletionCallback& cc);
};
diff --git a/ppapi/shared_impl/graphics_3d_impl.cc b/ppapi/shared_impl/graphics_3d_impl.cc
index a01b763..0299f5f 100644
--- a/ppapi/shared_impl/graphics_3d_impl.cc
+++ b/ppapi/shared_impl/graphics_3d_impl.cc
@@ -33,6 +33,15 @@ int32_t Graphics3DImpl::SetAttribs(int32_t* attrib_list) {
return PP_ERROR_FAILED;
}
+int32_t Graphics3DImpl::ResizeBuffers(int32_t width, int32_t height) {
+ if ((width < 0) || (height < 0))
+ return PP_ERROR_BADARGUMENT;
+
+ gles2_impl()->ResizeCHROMIUM(width, height);
+ // TODO(alokp): Check if resize succeeded and return appropriate error code.
+ return PP_OK;
+}
+
int32_t Graphics3DImpl::SwapBuffers(PP_CompletionCallback callback) {
if (!callback.func) {
// Blocking SwapBuffers isn't supported (since we have to be on the main
diff --git a/ppapi/shared_impl/graphics_3d_impl.h b/ppapi/shared_impl/graphics_3d_impl.h
index 41a71af..781f33f 100644
--- a/ppapi/shared_impl/graphics_3d_impl.h
+++ b/ppapi/shared_impl/graphics_3d_impl.h
@@ -25,6 +25,7 @@ class Graphics3DImpl : public thunk::PPB_Graphics3D_API {
// PPB_Graphics3D_API implementation.
virtual int32_t GetAttribs(int32_t* attrib_list) OVERRIDE;
virtual int32_t SetAttribs(int32_t* attrib_list) OVERRIDE;
+ virtual int32_t ResizeBuffers(int32_t width, int32_t height) OVERRIDE;
virtual int32_t SwapBuffers(PP_CompletionCallback callback) OVERRIDE;
gpu::gles2::GLES2Implementation* gles2_impl() {
diff --git a/ppapi/thunk/ppb_graphics_3d_api.h b/ppapi/thunk/ppb_graphics_3d_api.h
index 8871d6b..f513b17 100644
--- a/ppapi/thunk/ppb_graphics_3d_api.h
+++ b/ppapi/thunk/ppb_graphics_3d_api.h
@@ -18,6 +18,7 @@ class PPB_Graphics3D_API {
// Graphics3D API.
virtual int32_t GetAttribs(int32_t* attrib_list) = 0;
virtual int32_t SetAttribs(int32_t* attrib_list) = 0;
+ virtual int32_t ResizeBuffers(int32_t width, int32_t height) = 0;
virtual int32_t SwapBuffers(PP_CompletionCallback callback) = 0;
// Graphics3DTrusted API.
diff --git a/ppapi/thunk/ppb_graphics_3d_thunk.cc b/ppapi/thunk/ppb_graphics_3d_thunk.cc
index c3363f20..1ea23cd 100644
--- a/ppapi/thunk/ppb_graphics_3d_thunk.cc
+++ b/ppapi/thunk/ppb_graphics_3d_thunk.cc
@@ -64,6 +64,13 @@ int32_t SetAttribs(PP_Resource graphics_3d, int32_t* attrib_list) {
return enter.object()->SetAttribs(attrib_list);
}
+int32_t ResizeBuffers(PP_Resource graphics_3d, int32_t width, int32_t height) {
+ EnterGraphics3D enter(graphics_3d, true);
+ if (enter.failed())
+ return PP_ERROR_BADRESOURCE;
+ return enter.object()->ResizeBuffers(width, height);
+}
+
int32_t SwapBuffers(PP_Resource graphics_3d, PP_CompletionCallback callback) {
EnterGraphics3D enter(graphics_3d, true);
if (enter.failed())
@@ -80,6 +87,7 @@ const PPB_Graphics3D_Dev g_ppb_graphics_3d_thunk = {
&IsGraphics3D,
&GetAttribs,
&SetAttribs,
+ &ResizeBuffers,
&SwapBuffers
};