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_android.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.cc ('k') | ui/gl/init/gl_factory_mac.cc » ('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/logging.h" 7 #include "base/logging.h"
8 #include "base/trace_event/trace_event.h" 8 #include "base/trace_event/trace_event.h"
9 #include "ui/gl/gl_bindings.h" 9 #include "ui/gl/gl_bindings.h"
10 #include "ui/gl/gl_context.h" 10 #include "ui/gl/gl_context.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return InitializeGLSurface(new NativeViewGLSurfaceEGL(window)); 124 return InitializeGLSurface(new NativeViewGLSurfaceEGL(window));
125 } else { 125 } else {
126 return InitializeGLSurface(new GLSurfaceStub()); 126 return InitializeGLSurface(new GLSurfaceStub());
127 } 127 }
128 default: 128 default:
129 NOTREACHED(); 129 NOTREACHED();
130 return nullptr; 130 return nullptr;
131 } 131 }
132 } 132 }
133 133
134 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { 134 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
135 const gfx::Size& size, GLSurfaceFormat format) {
135 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); 136 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
136 CHECK_NE(kGLImplementationNone, GetGLImplementation()); 137 CHECK_NE(kGLImplementationNone, GetGLImplementation());
137 switch (GetGLImplementation()) { 138 switch (GetGLImplementation()) {
138 case kGLImplementationOSMesaGL: { 139 case kGLImplementationOSMesaGL: {
139 return InitializeGLSurface( 140 format.SetDefaultPixelLayout(GLSurfaceFormat::PIXEL_LAYOUT_BGRA);
140 new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_BGRA, size)); 141 return InitializeGLSurfaceWithFormat(
142 new GLSurfaceOSMesa(format, size), format);
141 } 143 }
142 case kGLImplementationEGLGLES2: { 144 case kGLImplementationEGLGLES2: {
143 scoped_refptr<GLSurface> surface;
144 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && 145 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() &&
145 (size.width() == 0 && size.height() == 0)) { 146 (size.width() == 0 && size.height() == 0)) {
146 return InitializeGLSurface(new SurfacelessEGL(size)); 147 return InitializeGLSurfaceWithFormat(
148 new SurfacelessEGL(size), format);
147 } else { 149 } else {
148 return InitializeGLSurface(new PbufferGLSurfaceEGL(size)); 150 return InitializeGLSurfaceWithFormat(
151 new PbufferGLSurfaceEGL(size), format);
149 } 152 }
150 } 153 }
151 case kGLImplementationMockGL: 154 case kGLImplementationMockGL:
152 return new GLSurfaceStub; 155 return new GLSurfaceStub;
153 default: 156 default:
154 NOTREACHED(); 157 NOTREACHED();
155 return nullptr; 158 return nullptr;
156 } 159 }
157 } 160 }
158 161
159 } // namespace init 162 } // namespace init
160 } // namespace gl 163 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_factory.cc ('k') | ui/gl/init/gl_factory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698