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

Side by Side Diff: ui/gl/gl_surface_android.cc

Issue 1652873002: Android: Use virtualized context only for those with compatible config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 10 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/gl_surface.cc ('k') | ui/gl/gl_surface_egl.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_surface.h" 5 #include "ui/gl/gl_surface.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "third_party/khronos/EGL/egl.h" 9 #include "third_party/khronos/EGL/egl.h"
10 #include "ui/gfx/native_widget_types.h" 10 #include "ui/gfx/native_widget_types.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } else { 47 } else {
48 scoped_refptr<GLSurface> surface = new GLSurfaceStub(); 48 scoped_refptr<GLSurface> surface = new GLSurfaceStub();
49 if (surface->Initialize()) 49 if (surface->Initialize())
50 return surface; 50 return surface;
51 } 51 }
52 return NULL; 52 return NULL;
53 } 53 }
54 54
55 // static 55 // static
56 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( 56 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
57 const gfx::Size& size, 57 const gfx::Size& size) {
58 GLSurface::Format format) {
59 CHECK_NE(kGLImplementationNone, GetGLImplementation()); 58 CHECK_NE(kGLImplementationNone, GetGLImplementation());
60 switch (GetGLImplementation()) { 59 switch (GetGLImplementation()) {
61 case kGLImplementationOSMesaGL: { 60 case kGLImplementationOSMesaGL: {
62 scoped_refptr<GLSurface> surface( 61 scoped_refptr<GLSurface> surface(
63 new GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, size)); 62 new GLSurfaceOSMesa(SURFACE_OSMESA_BGRA, size));
64 if (!surface->Initialize(format)) 63 if (!surface->Initialize())
65 return NULL; 64 return NULL;
66 65
67 return surface; 66 return surface;
68 } 67 }
69 case kGLImplementationEGLGLES2: { 68 case kGLImplementationEGLGLES2: {
70 scoped_refptr<GLSurface> surface; 69 scoped_refptr<GLSurface> surface;
71 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && 70 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() &&
72 (size.width() == 0 && size.height() == 0)) { 71 (size.width() == 0 && size.height() == 0)) {
73 surface = new SurfacelessEGL(size); 72 surface = new SurfacelessEGL(size);
74 } else { 73 } else {
75 surface = new PbufferGLSurfaceEGL(size); 74 surface = new PbufferGLSurfaceEGL(size);
76 } 75 }
77 76
78 if (!surface->Initialize(format)) 77 if (!surface->Initialize())
79 return NULL; 78 return NULL;
80 return surface; 79 return surface;
81 } 80 }
82 case kGLImplementationMockGL: 81 case kGLImplementationMockGL:
83 return new GLSurfaceStub; 82 return new GLSurfaceStub;
84 default: 83 default:
85 NOTREACHED(); 84 NOTREACHED();
86 return NULL; 85 return NULL;
87 } 86 }
88 } 87 }
89 88
90 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 89 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
91 return EGL_DEFAULT_DISPLAY; 90 return EGL_DEFAULT_DISPLAY;
92 } 91 }
93 92
94 } // namespace gfx 93 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gl_surface.cc ('k') | ui/gl/gl_surface_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698