| 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/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 return false; | 244 return false; |
| 245 } | 245 } |
| 246 } | 246 } |
| 247 | 247 |
| 248 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)); | 248 surface_ = gfx::GLSurface::CreateOffscreenGLSurface(false, gfx::Size(1, 1)); |
| 249 if (!surface_.get()) { | 249 if (!surface_.get()) { |
| 250 LOG(ERROR) << "Unable to create offscreen GL surface."; | 250 LOG(ERROR) << "Unable to create offscreen GL surface."; |
| 251 return false; | 251 return false; |
| 252 } | 252 } |
| 253 | 253 |
| 254 context_ = gfx::GLContext::CreateGLContext(NULL, surface_.get()); | 254 context_ = gfx::GLContext::CreateGLContext( |
| 255 NULL, |
| 256 surface_.get(), |
| 257 gfx::PreferIntegratedGpu); |
| 255 if (!context_.get()) { | 258 if (!context_.get()) { |
| 256 LOG(ERROR) << "Unable to create GL context."; | 259 LOG(ERROR) << "Unable to create GL context."; |
| 257 return false; | 260 return false; |
| 258 } | 261 } |
| 259 | 262 |
| 260 program_no_swizzle_.reset(); | 263 program_no_swizzle_.reset(); |
| 261 program_swizzle_.reset(); | 264 program_swizzle_.reset(); |
| 262 | 265 |
| 263 context_->MakeCurrent(surface_.get()); | 266 context_->MakeCurrent(surface_.get()); |
| 264 | 267 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 bool SharedResources::MakeSharedContextCurrent() { | 299 bool SharedResources::MakeSharedContextCurrent() { |
| 297 if (!initialized_) | 300 if (!initialized_) |
| 298 return false; | 301 return false; |
| 299 else | 302 else |
| 300 return context_->MakeCurrent(surface_.get()); | 303 return context_->MakeCurrent(surface_.get()); |
| 301 } | 304 } |
| 302 | 305 |
| 303 scoped_refptr<gfx::GLContext> SharedResources::CreateContext( | 306 scoped_refptr<gfx::GLContext> SharedResources::CreateContext( |
| 304 gfx::GLSurface* surface) { | 307 gfx::GLSurface* surface) { |
| 305 if (initialized_) | 308 if (initialized_) |
| 306 return gfx::GLContext::CreateGLContext(context_->share_group(), surface); | 309 return gfx::GLContext::CreateGLContext( |
| 310 context_->share_group(), |
| 311 surface, |
| 312 gfx::PreferIntegratedGpu); |
| 307 else | 313 else |
| 308 return NULL; | 314 return NULL; |
| 309 } | 315 } |
| 310 | 316 |
| 311 TextureGL::TextureGL() : texture_id_(0) { | 317 TextureGL::TextureGL() : texture_id_(0) { |
| 312 } | 318 } |
| 313 | 319 |
| 314 TextureGL::TextureGL(const gfx::Size& size) : texture_id_(0), size_(size) { | 320 TextureGL::TextureGL(const gfx::Size& size) : texture_id_(0), size_(size) { |
| 315 } | 321 } |
| 316 | 322 |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 Compositor* Compositor::Create(CompositorDelegate* owner, | 543 Compositor* Compositor::Create(CompositorDelegate* owner, |
| 538 gfx::AcceleratedWidget widget, | 544 gfx::AcceleratedWidget widget, |
| 539 const gfx::Size& size) { | 545 const gfx::Size& size) { |
| 540 if (SharedResources::GetInstance() == NULL) | 546 if (SharedResources::GetInstance() == NULL) |
| 541 return NULL; | 547 return NULL; |
| 542 else | 548 else |
| 543 return new CompositorGL(owner, widget, size); | 549 return new CompositorGL(owner, widget, size); |
| 544 } | 550 } |
| 545 | 551 |
| 546 } // namespace ui | 552 } // namespace ui |
| OLD | NEW |