| OLD | NEW |
| 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/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 case kGLImplementationMockGL: | 108 case kGLImplementationMockGL: |
| 109 return new GLSurfaceStub; | 109 return new GLSurfaceStub; |
| 110 default: | 110 default: |
| 111 NOTREACHED(); | 111 NOTREACHED(); |
| 112 return nullptr; | 112 return nullptr; |
| 113 } | 113 } |
| 114 } | 114 } |
| 115 | 115 |
| 116 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { | 116 scoped_refptr<GLSurface> CreateOffscreenGLSurface(const gfx::Size& size) { |
| 117 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); | 117 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); |
| 118 scoped_refptr<GLSurface> surface = |
| 119 CreateUninitializedOffscreenGLSurface(size); |
| 120 if (surface && GetGLImplementation() != kGLImplementationMockGL) |
| 121 InitializeGLSurface(surface); |
| 122 return surface; |
| 123 } |
| 124 |
| 125 scoped_refptr<GLSurface> CreateUninitializedOffscreenGLSurface( |
| 126 const gfx::Size& size) { |
| 127 TRACE_EVENT0("gpu", "gl::init::CreateUninitializedOffscreenGLSurface"); |
| 118 switch (GetGLImplementation()) { | 128 switch (GetGLImplementation()) { |
| 119 case kGLImplementationOSMesaGL: | 129 case kGLImplementationOSMesaGL: |
| 120 return InitializeGLSurface( | 130 return new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_RGBA, size); |
| 121 new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_RGBA, size)); | |
| 122 case kGLImplementationDesktopGL: | 131 case kGLImplementationDesktopGL: |
| 123 case kGLImplementationDesktopGLCoreProfile: | 132 case kGLImplementationDesktopGLCoreProfile: |
| 124 case kGLImplementationAppleGL: | 133 case kGLImplementationAppleGL: |
| 125 return InitializeGLSurface(new NoOpGLSurface(size)); | 134 return new NoOpGLSurface(size); |
| 126 case kGLImplementationMockGL: | 135 case kGLImplementationMockGL: |
| 127 return new GLSurfaceStub; | 136 return new GLSurfaceStub; |
| 128 default: | 137 default: |
| 129 NOTREACHED(); | 138 NOTREACHED(); |
| 130 return nullptr; | 139 return nullptr; |
| 131 } | 140 } |
| 132 } | 141 } |
| 133 | 142 |
| 134 } // namespace init | 143 } // namespace init |
| 135 } // namespace gl | 144 } // namespace gl |
| OLD | NEW |