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

Side by Side Diff: ui/gl/gl_context_osmesa.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/BUILD.gn ('k') | ui/gl/gl_surface.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 "ui/gl/gl_context_osmesa.h" 5 #include "ui/gl/gl_context_osmesa.h"
6 6
7 #include <GL/osmesa.h> 7 #include <GL/osmesa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gfx/geometry/size.h" 10 #include "ui/gfx/geometry/size.h"
(...skipping 14 matching lines...) Expand all
25 // supported. 25 // supported.
26 DCHECK(!attribs.webgl_compatibility_context && 26 DCHECK(!attribs.webgl_compatibility_context &&
27 attribs.bind_generates_resource); 27 attribs.bind_generates_resource);
28 28
29 DCHECK(!context_); 29 DCHECK(!context_);
30 30
31 OSMesaContext share_handle = static_cast<OSMesaContext>( 31 OSMesaContext share_handle = static_cast<OSMesaContext>(
32 share_group() ? share_group()->GetHandle() : nullptr); 32 share_group() ? share_group()->GetHandle() : nullptr);
33 33
34 GLuint format = 0; 34 GLuint format = 0;
35 switch (compatible_surface->GetFormat()) { 35 switch (compatible_surface->GetFormat().GetPixelLayout()) {
36 case GLSurface::SURFACE_OSMESA_BGRA: 36 case GLSurfaceFormat::PIXEL_LAYOUT_BGRA:
37 format = OSMESA_BGRA; 37 format = OSMESA_BGRA;
38 break; 38 break;
39 case GLSurface::SURFACE_OSMESA_RGBA: 39 case GLSurfaceFormat::PIXEL_LAYOUT_RGBA:
40 format = OSMESA_RGBA; 40 format = OSMESA_RGBA;
41 break; 41 break;
42 default: 42 default:
43 NOTREACHED(); 43 NOTREACHED();
44 return false; 44 return false;
45 } 45 }
46 context_ = OSMesaCreateContextExt(format, 46 context_ = OSMesaCreateContextExt(format,
47 0, // depth bits 47 0, // depth bits
48 0, // stencil bits 48 0, // stencil bits
49 0, // accum bits 49 0, // accum bits
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 147
148 void GLContextOSMesa::OnSetSwapInterval(int interval) { 148 void GLContextOSMesa::OnSetSwapInterval(int interval) {
149 DCHECK(IsCurrent(nullptr)); 149 DCHECK(IsCurrent(nullptr));
150 } 150 }
151 151
152 GLContextOSMesa::~GLContextOSMesa() { 152 GLContextOSMesa::~GLContextOSMesa() {
153 Destroy(); 153 Destroy();
154 } 154 }
155 155
156 } // namespace gl 156 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/BUILD.gn ('k') | ui/gl/gl_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698