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

Unified Diff: content/renderer/pepper_platform_context_3d_impl.cc

Issue 7530010: Added PPB_Graphics3D_Dev::Resize to let plugins resize the backing surface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months 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 | « content/renderer/pepper_platform_context_3d_impl.h ('k') | ppapi/c/dev/ppb_graphics_3d_dev.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper_platform_context_3d_impl.cc
===================================================================
--- content/renderer/pepper_platform_context_3d_impl.cc (revision 94518)
+++ content/renderer/pepper_platform_context_3d_impl.cc (working copy)
@@ -40,7 +40,7 @@
channel_ = NULL;
}
-bool PlatformContext3DImpl::Init() {
+bool PlatformContext3DImpl::Init(const int32* attrib_list) {
// Ignore initializing more than once.
if (command_buffer_)
return true;
@@ -66,20 +66,35 @@
parent_gles2->helper()->CommandBufferHelper::Finish();
parent_texture_id_ = parent_gles2->MakeTextureId();
- // TODO(apatrick): Let Pepper plugins configure their back buffer surface.
- static const int32 kAttribs[] = {
- RendererGLContext::ALPHA_SIZE, 8,
- RendererGLContext::DEPTH_SIZE, 24,
- RendererGLContext::STENCIL_SIZE, 8,
- RendererGLContext::SAMPLES, 0,
- RendererGLContext::SAMPLE_BUFFERS, 0,
- RendererGLContext::NONE,
- };
- std::vector<int32> attribs(kAttribs, kAttribs + ARRAYSIZE_UNSAFE(kAttribs));
+ gfx::Size surface_size;
+ std::vector<int32> attribs;
+ // TODO(alokp): Change GpuChannelHost::CreateOffscreenCommandBuffer()
+ // interface to accept width and height in the attrib_list so that
+ // we do not need to filter for width and height here.
+ if (attrib_list) {
+ for (const int32_t* attr = attrib_list;
+ attr[0] != RendererGLContext::NONE;
+ attr += 2) {
+ switch (attr[0]) {
+ case RendererGLContext::WIDTH:
+ surface_size.set_width(attr[1]);
+ break;
+ case RendererGLContext::HEIGHT:
+ surface_size.set_height(attr[1]);
+ break;
+ default:
+ attribs.push_back(attr[0]);
+ attribs.push_back(attr[1]);
+ break;
+ }
+ }
+ attribs.push_back(RendererGLContext::NONE);
+ }
+
CommandBufferProxy* parent_command_buffer =
parent_context_->GetCommandBufferProxy();
command_buffer_ = channel_->CreateOffscreenCommandBuffer(
- gfx::Size(1, 1),
+ surface_size,
"*",
attribs,
GURL::EmptyGURL());
« no previous file with comments | « content/renderer/pepper_platform_context_3d_impl.h ('k') | ppapi/c/dev/ppb_graphics_3d_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698