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

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

Issue 2165303002: Convert Ozone GBM to use new surface API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ozone_impl
Patch Set: Add missing dep. Created 4 years, 4 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 | « no previous file | ui/gl/init/gl_surface_ozone.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/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_context.h" 9 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_context_egl.h" 10 #include "ui/gl/gl_context_egl.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 return InitializeGLSurface(new GLSurfaceStub); 57 return InitializeGLSurface(new GLSurfaceStub);
58 default: 58 default:
59 NOTREACHED(); 59 NOTREACHED();
60 } 60 }
61 return nullptr; 61 return nullptr;
62 } 62 }
63 63
64 // TODO(kylechar): Remove when all implementations are switched over. 64 // TODO(kylechar): Remove when all implementations are switched over.
65 scoped_refptr<GLSurface> CreateViewGLSurfaceOld(gfx::AcceleratedWidget window) { 65 scoped_refptr<GLSurface> CreateViewGLSurfaceOld(gfx::AcceleratedWidget window) {
66 switch (GetGLImplementation()) { 66 switch (GetGLImplementation()) {
67 case kGLImplementationEGLGLES2: { 67 case kGLImplementationEGLGLES2:
68 DCHECK_NE(window, gfx::kNullAcceleratedWidget); 68 DCHECK_NE(window, gfx::kNullAcceleratedWidget);
69 scoped_refptr<GLSurface> surface; 69 return CreateViewGLSurfaceOzone(window);
70 if (!surface && GLSurfaceEGL::IsEGLSurfacelessContextSupported())
71 surface = CreateViewGLSurfaceOzoneSurfacelessSurfaceImpl(window);
72 if (!surface)
73 surface = CreateViewGLSurfaceOzone(window);
74 return surface;
75 }
76 default: 70 default:
77 NOTREACHED(); 71 NOTREACHED();
78 return nullptr;
79 } 72 }
73 return nullptr;
80 } 74 }
81 75
82 // TODO(kylechar): Remove when all implementations are switched over. 76 // TODO(kylechar): Remove when all implementations are switched over.
83 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceOld(const gfx::Size& size) { 77 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceOld(const gfx::Size& size) {
84 switch (GetGLImplementation()) { 78 switch (GetGLImplementation()) {
85 case kGLImplementationEGLGLES2: 79 case kGLImplementationEGLGLES2:
86 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && 80 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() &&
87 (size.width() == 0 && size.height() == 0)) { 81 (size.width() == 0 && size.height() == 0)) {
88 return InitializeGLSurface(new SurfacelessEGL(size)); 82 return InitializeGLSurface(new SurfacelessEGL(size));
89 } else { 83 } else {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 return CreateDefaultViewGLSurface(window); 118 return CreateDefaultViewGLSurface(window);
125 119
126 // TODO(kylechar): This is deprecated, remove when possible. 120 // TODO(kylechar): This is deprecated, remove when possible.
127 if (!GetSurfaceFactory()->UseNewSurfaceAPI()) 121 if (!GetSurfaceFactory()->UseNewSurfaceAPI())
128 return CreateViewGLSurfaceOld(window); 122 return CreateViewGLSurfaceOld(window);
129 123
130 return GetSurfaceFactory()->CreateViewGLSurface(GetGLImplementation(), 124 return GetSurfaceFactory()->CreateViewGLSurface(GetGLImplementation(),
131 window); 125 window);
132 } 126 }
133 127
134 // TODO(kylechar): Update to use new API.
135 scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( 128 scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface(
136 gfx::AcceleratedWidget window) { 129 gfx::AcceleratedWidget window) {
137 TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface"); 130 TRACE_EVENT0("gpu", "gl::init::CreateSurfacelessViewGLSurface");
138 if (GetGLImplementation() == kGLImplementationEGLGLES2 && 131
139 window != gfx::kNullAcceleratedWidget && 132 return GetSurfaceFactory()->CreateSurfacelessViewGLSurface(
140 GLSurfaceEGL::IsEGLSurfacelessContextSupported()) { 133 GetGLImplementation(), window);
141 return CreateViewGLSurfaceOzoneSurfaceless(window);
142 }
143 return nullptr;
144 } 134 }
145 135
146 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { 136 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) {
147 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); 137 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
148 138
149 if (HasDefaultImplementation(GetGLImplementation())) 139 if (HasDefaultImplementation(GetGLImplementation()))
150 return CreateDefaultOffscreenGLSurface(size); 140 return CreateDefaultOffscreenGLSurface(size);
151 141
152 // TODO(kylechar): This is deprecated, remove when possible. 142 // TODO(kylechar): This is deprecated, remove when possible.
153 if (!GetSurfaceFactory()->UseNewSurfaceAPI()) 143 if (!GetSurfaceFactory()->UseNewSurfaceAPI())
154 return CreateOffscreenGLSurfaceOld(size); 144 return CreateOffscreenGLSurfaceOld(size);
155 145
156 return GetSurfaceFactory()->CreateOffscreenGLSurface(GetGLImplementation(), 146 return GetSurfaceFactory()->CreateOffscreenGLSurface(GetGLImplementation(),
157 size); 147 size);
158 } 148 }
159 149
160 } // namespace init 150 } // namespace init
161 } // namespace gl 151 } // namespace gl
OLDNEW
« no previous file with comments | « no previous file | ui/gl/init/gl_surface_ozone.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698