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

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

Issue 2461803002: Enable creation of offscreen contexts which own their backing surface. (Closed)
Patch Set: Drop unnecessary dependent patch Created 4 years, 1 month 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 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 case kGLImplementationMockGL: 88 case kGLImplementationMockGL:
89 return new GLSurfaceStub; 89 return new GLSurfaceStub;
90 default: 90 default:
91 NOTREACHED(); 91 NOTREACHED();
92 return nullptr; 92 return nullptr;
93 } 93 }
94 } 94 }
95 95
96 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { 96 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) {
97 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); 97 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
98 scoped_refptr<GLSurface> surface =
99 CreateUninitializedOffscreenGLSurface(size);
100 if (surface && GetGLImplementation() != kGLImplementationMockGL)
101 InitializeGLSurface(surface);
102 return surface;
103 }
104
105 scoped_refptr<GLSurface> CreateUninitializedOffscreenGLSurface(
106 const gfx::Size& size) {
107 TRACE_EVENT0("gpu", "gl::init::CreateUninitializedOffscreenGLSurface");
98 switch (GetGLImplementation()) { 108 switch (GetGLImplementation()) {
99 case kGLImplementationOSMesaGL: 109 case kGLImplementationOSMesaGL:
100 return InitializeGLSurface( 110 return new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_RGBA, size);
101 new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_RGBA, size));
102 case kGLImplementationEGLGLES2: 111 case kGLImplementationEGLGLES2:
103 return InitializeGLSurface(new PbufferGLSurfaceEGL(size)); 112 return new PbufferGLSurfaceEGL(size);
104 case kGLImplementationDesktopGL: 113 case kGLImplementationDesktopGL:
105 return InitializeGLSurface(new PbufferGLSurfaceWGL(size)); 114 return new PbufferGLSurfaceWGL(size);
106 case kGLImplementationMockGL: 115 case kGLImplementationMockGL:
107 return new GLSurfaceStub; 116 return new GLSurfaceStub;
108 default: 117 default:
109 NOTREACHED(); 118 NOTREACHED();
110 return nullptr; 119 return nullptr;
111 } 120 }
112 } 121 }
113 122
114 } // namespace init 123 } // namespace init
115 } // namespace gl 124 } // namespace gl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698