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

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

Issue 1168993002: Update the native_viewport interface to allow specification of the surface configuration, currently… (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 6 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
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 13 matching lines...) Expand all
24 return false; 24 return false;
25 } 25 }
26 default: 26 default:
27 break; 27 break;
28 } 28 }
29 return true; 29 return true;
30 } 30 }
31 31
32 // static 32 // static
33 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( 33 scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface(
34 gfx::AcceleratedWidget window) { 34 gfx::AcceleratedWidget window,
35 SurfaceConfiguration requested_configuration) {
abarth-chromium 2015/06/09 00:30:22 const gfx::SurfaceConfiguration& Below you use th
iansf 2015/06/09 01:52:05 Done.
35 CHECK_NE(kGLImplementationNone, GetGLImplementation()); 36 CHECK_NE(kGLImplementationNone, GetGLImplementation());
36 if (GetGLImplementation() == kGLImplementationOSMesaGL) { 37 if (GetGLImplementation() == kGLImplementationOSMesaGL) {
37 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesaHeadless()); 38 scoped_refptr<GLSurface> surface(
39 new GLSurfaceOSMesaHeadless(SurfaceConfiguration()));
38 if (!surface->Initialize()) 40 if (!surface->Initialize())
39 return NULL; 41 return NULL;
40 return surface; 42 return surface;
41 } 43 }
42 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2); 44 DCHECK(GetGLImplementation() == kGLImplementationEGLGLES2);
43 if (window != kNullAcceleratedWidget) { 45 if (window != kNullAcceleratedWidget) {
44 scoped_refptr<GLSurface> surface = new NativeViewGLSurfaceEGL(window); 46 scoped_refptr<GLSurface> surface =
47 new NativeViewGLSurfaceEGL(window, requested_configuration);
45 if (surface->Initialize()) 48 if (surface->Initialize())
46 return surface; 49 return surface;
47 } else { 50 } else {
48 scoped_refptr<GLSurface> surface = new GLSurfaceStub(); 51 scoped_refptr<GLSurface> surface =
52 new GLSurfaceStub(requested_configuration);
49 if (surface->Initialize()) 53 if (surface->Initialize())
50 return surface; 54 return surface;
51 } 55 }
52 return NULL; 56 return NULL;
53 } 57 }
54 58
55 // static 59 // static
56 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( 60 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface(
57 const gfx::Size& size) { 61 const gfx::Size& size,
62 gfx::SurfaceConfiguration requested_configuration) {
abarth-chromium 2015/06/09 00:30:22 const gfx::SurfaceConfiguration&
iansf 2015/06/09 01:52:04 Done.
58 CHECK_NE(kGLImplementationNone, GetGLImplementation()); 63 CHECK_NE(kGLImplementationNone, GetGLImplementation());
59 switch (GetGLImplementation()) { 64 switch (GetGLImplementation()) {
60 case kGLImplementationOSMesaGL: { 65 case kGLImplementationOSMesaGL: {
61 scoped_refptr<GLSurface> surface( 66 scoped_refptr<GLSurface> surface(new GLSurfaceOSMesa(
62 new GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, size)); 67 OSMesaSurfaceFormatBGRA, size, requested_configuration));
63 if (!surface->Initialize()) 68 if (!surface->Initialize())
64 return NULL; 69 return NULL;
65 70
66 return surface; 71 return surface;
67 } 72 }
68 case kGLImplementationEGLGLES2: { 73 case kGLImplementationEGLGLES2: {
69 scoped_refptr<GLSurface> surface; 74 scoped_refptr<GLSurface> surface;
70 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && 75 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() &&
71 (size.width() == 0 && size.height() == 0)) { 76 (size.width() == 0 && size.height() == 0)) {
72 surface = new SurfacelessEGL(size); 77 surface = new SurfacelessEGL(size, requested_configuration);
73 } else { 78 } else {
74 surface = new PbufferGLSurfaceEGL(size); 79 surface = new PbufferGLSurfaceEGL(size, requested_configuration);
75 } 80 }
76 81
77 if (!surface->Initialize()) 82 if (!surface->Initialize())
78 return NULL; 83 return NULL;
79 return surface; 84 return surface;
80 } 85 }
81 default: 86 default:
82 NOTREACHED(); 87 NOTREACHED();
83 return NULL; 88 return NULL;
84 } 89 }
85 } 90 }
86 91
87 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { 92 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() {
88 return EGL_DEFAULT_DISPLAY; 93 return EGL_DEFAULT_DISPLAY;
89 } 94 }
90 95
91 } // namespace gfx 96 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698