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

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

Issue 2616723002: Refactor GL surface format handling (Closed)
Patch Set: Fix copyright notice on new files 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
« no previous file with comments | « ui/gl/init/gl_factory_win.cc ('k') | ui/ozone/platform/drm/gpu/gbm_surfaceless.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 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 format.SetDefaultPixelLayout(GLSurfaceFormat::PIXEL_LAYOUT_RGBA);
93 new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_RGBA, size)); 94 return InitializeGLSurfaceWithFormat(
95 new GLSurfaceOSMesa(format, size), format);
94 case kGLImplementationDesktopGL: 96 case kGLImplementationDesktopGL:
95 return InitializeGLSurface(new UnmappedNativeViewGLSurfaceGLX(size)); 97 return InitializeGLSurfaceWithFormat(
98 new UnmappedNativeViewGLSurfaceGLX(size), format);
96 case kGLImplementationEGLGLES2: 99 case kGLImplementationEGLGLES2:
97 return InitializeGLSurface(new PbufferGLSurfaceEGL(size)); 100 return InitializeGLSurfaceWithFormat(
101 new PbufferGLSurfaceEGL(size), format);
98 case kGLImplementationMockGL: 102 case kGLImplementationMockGL:
99 return new GLSurfaceStub; 103 return new GLSurfaceStub;
100 default: 104 default:
101 NOTREACHED(); 105 NOTREACHED();
102 return nullptr; 106 return nullptr;
103 } 107 }
104 } 108 }
105 109
106 } // namespace init 110 } // namespace init
107 } // namespace gl 111 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_factory_win.cc ('k') | ui/ozone/platform/drm/gpu/gbm_surfaceless.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698