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,43 @@ |
parent_gles2->helper()->CommandBufferHelper::Finish(); |
parent_texture_id_ = parent_gles2->MakeTextureId(); |
- // TODO(apatrick): Let Pepper plugins configure their back buffer surface. |
+ // TODO(alokp): Remove this when we deprecate PPB_Context3D. |
static const int32 kAttribs[] = { |
RendererGLContext::ALPHA_SIZE, 8, |
RendererGLContext::DEPTH_SIZE, 24, |
RendererGLContext::STENCIL_SIZE, 8, |
RendererGLContext::SAMPLES, 0, |
RendererGLContext::SAMPLE_BUFFERS, 0, |
+ RendererGLContext::HEIGHT, 1, |
+ RendererGLContext::WIDTH, 1, |
RendererGLContext::NONE, |
}; |
piman
2011/07/28 23:35:06
You could move this to PPB_Context3D_Impl
alokp
2011/07/29 16:13:12
Good idea. Done.
|
- std::vector<int32> attribs(kAttribs, kAttribs + ARRAYSIZE_UNSAFE(kAttribs)); |
+ attrib_list = attrib_list ? attrib_list : kAttribs; |
+ |
+ gfx::Size surface_size; |
+ std::vector<int32> attribs; |
+ 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()); |