| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/compositor/compositor_gl.h" | 5 #include "ui/gfx/compositor/compositor_gl.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 void SharedResourcesGL::Destroy() { | 335 void SharedResourcesGL::Destroy() { |
| 336 program_swizzle_.reset(); | 336 program_swizzle_.reset(); |
| 337 program_no_swizzle_.reset(); | 337 program_no_swizzle_.reset(); |
| 338 | 338 |
| 339 context_ = NULL; | 339 context_ = NULL; |
| 340 surface_ = NULL; | 340 surface_ = NULL; |
| 341 | 341 |
| 342 initialized_ = false; | 342 initialized_ = false; |
| 343 } | 343 } |
| 344 | 344 |
| 345 bool SharedResourcesGL::MakeSharedContextCurrent() { | 345 gfx::ScopedMakeCurrent* SharedResourcesGL::GetScopedMakeCurrent() { |
| 346 if (!initialized_) | 346 if (initialized_) |
| 347 return false; | 347 return new gfx::ScopedMakeCurrent(context_.get(), surface_.get()); |
| 348 else | 348 else |
| 349 return context_->MakeCurrent(surface_.get()); | 349 return NULL; |
| 350 } | |
| 351 | |
| 352 gfx::ScopedMakeCurrent* SharedResourcesGL::GetScopedMakeCurrent() { | |
| 353 return new gfx::ScopedMakeCurrent(context_.get(), surface_.get()); | |
| 354 } | 350 } |
| 355 | 351 |
| 356 scoped_refptr<gfx::GLContext> SharedResourcesGL::CreateContext( | 352 scoped_refptr<gfx::GLContext> SharedResourcesGL::CreateContext( |
| 357 gfx::GLSurface* surface) { | 353 gfx::GLSurface* surface) { |
| 358 if (initialized_) | 354 if (initialized_) |
| 359 return gfx::GLContext::CreateGLContext( | 355 return gfx::GLContext::CreateGLContext( |
| 360 context_->share_group(), | 356 context_->share_group(), |
| 361 surface, | 357 surface, |
| 362 gfx::PreferIntegratedGpu); | 358 gfx::PreferIntegratedGpu); |
| 363 else | 359 else |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 Compositor* Compositor::Create(CompositorDelegate* owner, | 652 Compositor* Compositor::Create(CompositorDelegate* owner, |
| 657 gfx::AcceleratedWidget widget, | 653 gfx::AcceleratedWidget widget, |
| 658 const gfx::Size& size) { | 654 const gfx::Size& size) { |
| 659 if (SharedResourcesGL::GetInstance() == NULL) | 655 if (SharedResourcesGL::GetInstance() == NULL) |
| 660 return NULL; | 656 return NULL; |
| 661 else | 657 else |
| 662 return new CompositorGL(owner, widget, size); | 658 return new CompositorGL(owner, widget, size); |
| 663 } | 659 } |
| 664 | 660 |
| 665 } // namespace ui | 661 } // namespace ui |
| OLD | NEW |