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

Side by Side Diff: ui/gl/init/gl_factory_x11.cc

Issue 2616723002: Refactor GL surface format handling (Closed)
Patch Set: Created 3 years, 11 months 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
« ui/gl/gl_surface_egl.cc ('K') | « ui/gl/init/gl_factory_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/gl/init/gl_factory.h" 5 #include "ui/gl/init/gl_factory.h"
6 6
7 #include "base/trace_event/trace_event.h" 7 #include "base/trace_event/trace_event.h"
8 #include "ui/gl/gl_context.h" 8 #include "ui/gl/gl_context.h"
9 #include "ui/gl/gl_context_egl.h" 9 #include "ui/gl/gl_context_egl.h"
10 #include "ui/gl/gl_context_glx.h" 10 #include "ui/gl/gl_context_glx.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 DCHECK(window != gfx::kNullAcceleratedWidget); 78 DCHECK(window != gfx::kNullAcceleratedWidget);
79 return InitializeGLSurface(new NativeViewGLSurfaceEGLX11(window)); 79 return InitializeGLSurface(new NativeViewGLSurfaceEGLX11(window));
80 case kGLImplementationMockGL: 80 case kGLImplementationMockGL:
81 return new GLSurfaceStub; 81 return new GLSurfaceStub;
82 default: 82 default:
83 NOTREACHED(); 83 NOTREACHED();
84 return nullptr; 84 return nullptr;
85 } 85 }
86 } 86 }
87 87
88 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { 88 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
89 const gfx::Size& size, GLSurfaceFormat format) {
89 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); 90 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
90 switch (GetGLImplementation()) { 91 switch (GetGLImplementation()) {
91 case kGLImplementationOSMesaGL: 92 case kGLImplementationOSMesaGL:
92 return InitializeGLSurface( 93 if (format.IsDefault()) {
93 new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_RGBA, size)); 94 format = GLSurfaceFormat(GLSurfaceFormat::SURFACE_OSMESA_RGBA);
95 }
96 return InitializeGLSurfaceWithFormat(
97 new GLSurfaceOSMesa(format, size), format);
94 case kGLImplementationDesktopGL: 98 case kGLImplementationDesktopGL:
95 return InitializeGLSurface(new UnmappedNativeViewGLSurfaceGLX(size)); 99 return InitializeGLSurfaceWithFormat(
100 new UnmappedNativeViewGLSurfaceGLX(size), format);
96 case kGLImplementationEGLGLES2: 101 case kGLImplementationEGLGLES2:
97 return InitializeGLSurface(new PbufferGLSurfaceEGL(size)); 102 return InitializeGLSurfaceWithFormat(
103 new PbufferGLSurfaceEGL(size), format);
98 case kGLImplementationMockGL: 104 case kGLImplementationMockGL:
99 return new GLSurfaceStub; 105 return new GLSurfaceStub;
100 default: 106 default:
101 NOTREACHED(); 107 NOTREACHED();
102 return nullptr; 108 return nullptr;
103 } 109 }
104 } 110 }
105 111
106 } // namespace init 112 } // namespace init
107 } // namespace gl 113 } // namespace gl
OLDNEW
« ui/gl/gl_surface_egl.cc ('K') | « ui/gl/init/gl_factory_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698