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

Side by Side Diff: ui/gl/gl_context_mac.mm

Issue 56833002: Add a basic NativeViewportMac for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address ben's feedback Created 7 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/gl/gl.gyp ('k') | ui/gl/gl_context_nsview.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/debug/trace_event.h" 6 #include "base/debug/trace_event.h"
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "third_party/mesa/src/include/GL/osmesa.h" 9 #include "third_party/mesa/src/include/GL/osmesa.h"
10 #include "ui/gl/gl_context_cgl.h" 10 #include "ui/gl/gl_context_cgl.h"
11 #include "ui/gl/gl_context_nsview.h"
11 #include "ui/gl/gl_context_osmesa.h" 12 #include "ui/gl/gl_context_osmesa.h"
12 #include "ui/gl/gl_context_stub.h" 13 #include "ui/gl/gl_context_stub.h"
13 #include "ui/gl/gl_implementation.h" 14 #include "ui/gl/gl_implementation.h"
14 #include "ui/gl/gl_surface.h" 15 #include "ui/gl/gl_surface.h"
15 #include "ui/gl/gl_switches.h" 16 #include "ui/gl/gl_switches.h"
16 17
17 #if defined(USE_AURA)
18 #include "ui/gl/gl_context_nsview.h"
19 #endif
20
21 namespace gfx { 18 namespace gfx {
22 19
23 class GLShareGroup; 20 class GLShareGroup;
24 21
25 scoped_refptr<GLContext> GLContext::CreateGLContext( 22 scoped_refptr<GLContext> GLContext::CreateGLContext(
26 GLShareGroup* share_group, 23 GLShareGroup* share_group,
27 GLSurface* compatible_surface, 24 GLSurface* compatible_surface,
28 GpuPreference gpu_preference) { 25 GpuPreference gpu_preference) {
29 TRACE_EVENT0("gpu", "GLContext::CreateGLContext"); 26 TRACE_EVENT0("gpu", "GLContext::CreateGLContext");
30 switch (GetGLImplementation()) { 27 switch (GetGLImplementation()) {
31 case kGLImplementationDesktopGL: 28 case kGLImplementationDesktopGL:
32 case kGLImplementationAppleGL: { 29 case kGLImplementationAppleGL: {
33 scoped_refptr<GLContext> context; 30 scoped_refptr<GLContext> context;
34 #if defined(USE_AURA)
35 if (compatible_surface->IsOffscreen()) 31 if (compatible_surface->IsOffscreen())
36 context = new GLContextCGL(share_group); 32 context = new GLContextCGL(share_group);
37 else 33 else
38 context = new GLContextNSView(share_group); 34 context = new GLContextNSView(share_group);
39 #else
40 context = new GLContextCGL(share_group);
41 #endif // USE_AURA
42 if (!context->Initialize(compatible_surface, gpu_preference)) 35 if (!context->Initialize(compatible_surface, gpu_preference))
43 return NULL; 36 return NULL;
44 37
45 return context; 38 return context;
46 } 39 }
47 case kGLImplementationOSMesaGL: { 40 case kGLImplementationOSMesaGL: {
48 scoped_refptr<GLContext> context(new GLContextOSMesa(share_group)); 41 scoped_refptr<GLContext> context(new GLContextOSMesa(share_group));
49 if (!context->Initialize(compatible_surface, gpu_preference)) 42 if (!context->Initialize(compatible_surface, gpu_preference))
50 return NULL; 43 return NULL;
51 44
52 return context; 45 return context;
53 } 46 }
54 case kGLImplementationMockGL: 47 case kGLImplementationMockGL:
55 return new GLContextStub; 48 return new GLContextStub;
56 default: 49 default:
57 NOTREACHED(); 50 NOTREACHED();
58 return NULL; 51 return NULL;
59 } 52 }
60 } 53 }
61 54
62 } // namespace gfx 55 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl.gyp ('k') | ui/gl/gl_context_nsview.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698