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

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
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());

Powered by Google App Engine
This is Rietveld 408576698