Index: mojo/services/gles2/command_buffer_impl.cc |
diff --git a/mojo/services/gles2/command_buffer_impl.cc b/mojo/services/gles2/command_buffer_impl.cc |
index 090b78c370709a9d0f2ff2b0237f92d472da2e36..438ff903f87fda1dce04bed89ed92fd18dbf2d4b 100644 |
--- a/mojo/services/gles2/command_buffer_impl.cc |
+++ b/mojo/services/gles2/command_buffer_impl.cc |
@@ -73,18 +73,17 @@ void CommandBufferImpl::Initialize( |
bool CommandBufferImpl::DoInitialize( |
mojo::ScopedSharedBufferHandle shared_state) { |
// TODO(piman): offscreen surface. |
- scoped_refptr<gfx::GLSurface> surface = |
- gfx::GLSurface::CreateViewGLSurface(widget_); |
- if (!surface.get()) |
+ surface_ = gfx::GLSurface::CreateViewGLSurface(widget_); |
+ if (!surface_.get()) |
return false; |
// TODO(piman): context sharing, virtual contexts, gpu preference. |
scoped_refptr<gfx::GLContext> context = gfx::GLContext::CreateGLContext( |
- NULL, surface.get(), gfx::PreferIntegratedGpu); |
+ NULL, surface_.get(), gfx::PreferIntegratedGpu); |
if (!context.get()) |
return false; |
- if (!context->MakeCurrent(surface.get())) |
+ if (!context->MakeCurrent(surface_.get())) |
return false; |
// TODO(piman): ShaderTranslatorCache is currently per-ContextGroup but |
@@ -106,12 +105,14 @@ bool CommandBufferImpl::DoInitialize( |
scheduler_.reset(new gpu::GpuScheduler( |
command_buffer_.get(), decoder_.get(), decoder_.get())); |
decoder_->set_engine(scheduler_.get()); |
+ decoder_->SetResizeCallback( |
+ base::Bind(&CommandBufferImpl::OnResize, base::Unretained(this))); |
gpu::gles2::DisallowedFeatures disallowed_features; |
// TODO(piman): attributes. |
std::vector<int32> attrib_vector; |
- if (!decoder_->Initialize(surface, |
+ if (!decoder_->Initialize(surface_, |
context, |
false /* offscreen */, |
size_, |
@@ -194,5 +195,9 @@ void CommandBufferImpl::OnParseError() { |
void CommandBufferImpl::DrawAnimationFrame() { client()->DrawAnimationFrame(); } |
+void CommandBufferImpl::OnResize(gfx::Size size, float scale_factor) { |
+ surface_->Resize(size); |
+} |
+ |
} // namespace services |
} // namespace mojo |