| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/logging.h" | 6 #include "base/logging.h" |
| 7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
| 8 #include "base/memory/scoped_generic_obj.h" | 8 #include "base/memory/scoped_generic_obj.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" | 10 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 class GLShareGroup; | 36 class GLShareGroup; |
| 37 | 37 |
| 38 scoped_refptr<GLContext> GLContext::CreateGLContext( | 38 scoped_refptr<GLContext> GLContext::CreateGLContext( |
| 39 GLShareGroup* share_group, | 39 GLShareGroup* share_group, |
| 40 GLSurface* compatible_surface, | 40 GLSurface* compatible_surface, |
| 41 GpuPreference gpu_preference) { | 41 GpuPreference gpu_preference) { |
| 42 switch (GetGLImplementation()) { | 42 switch (GetGLImplementation()) { |
| 43 case kGLImplementationDesktopGL: { | 43 case kGLImplementationDesktopGL: { |
| 44 scoped_refptr<GLContext> context; | 44 scoped_refptr<GLContext> context; |
| 45 if (compatible_surface->IsOffscreen()) { | |
| 46 context = new GLContextCGL(share_group); | |
| 47 if (!context->Initialize(compatible_surface, gpu_preference)) | |
| 48 return NULL; | |
| 49 } else { | |
| 50 #if defined(USE_AURA) | 45 #if defined(USE_AURA) |
| 51 context = new GLContextNSView(share_group); | 46 DCHECK(!compatible_surface->IsOffscreen()); |
| 52 if (!context->Initialize(compatible_surface, gpu_preference)) | 47 context = new GLContextNSView(share_group); |
| 53 return NULL; | 48 if (!context->Initialize(compatible_surface, gpu_preference)) |
| 54 #endif | 49 return NULL; |
| 55 } | 50 #else |
| 51 context = new GLContextCGL(share_group); |
| 52 if (!context->Initialize(compatible_surface, gpu_preference)) |
| 53 return NULL; |
| 54 #endif // USE_AURA |
| 56 | 55 |
| 57 return context; | 56 return context; |
| 58 } | 57 } |
| 59 case kGLImplementationOSMesaGL: { | 58 case kGLImplementationOSMesaGL: { |
| 60 scoped_refptr<GLContext> context(new GLContextOSMesa(share_group)); | 59 scoped_refptr<GLContext> context(new GLContextOSMesa(share_group)); |
| 61 if (!context->Initialize(compatible_surface, gpu_preference)) | 60 if (!context->Initialize(compatible_surface, gpu_preference)) |
| 62 return NULL; | 61 return NULL; |
| 63 | 62 |
| 64 return context; | 63 return context; |
| 65 } | 64 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 } | 145 } |
| 147 | 146 |
| 148 if (found_online && found_offline) { | 147 if (found_online && found_offline) { |
| 149 supports_dual_gpus = true; | 148 supports_dual_gpus = true; |
| 150 } | 149 } |
| 151 | 150 |
| 152 return supports_dual_gpus; | 151 return supports_dual_gpus; |
| 153 } | 152 } |
| 154 | 153 |
| 155 } // namespace gfx | 154 } // namespace gfx |
| OLD | NEW |