| 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/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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 case kGLImplementationDesktopGL: | 86 case kGLImplementationDesktopGL: |
| 87 return InitializeGLSurface(new NativeViewGLSurfaceWGL(window)); | 87 return InitializeGLSurface(new NativeViewGLSurfaceWGL(window)); |
| 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> CreateOffscreenGLSurfaceWithFormat( |
| 97 const gfx::Size& size, GLSurfaceFormat format) { |
| 97 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); | 98 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); |
| 98 switch (GetGLImplementation()) { | 99 switch (GetGLImplementation()) { |
| 99 case kGLImplementationOSMesaGL: | 100 case kGLImplementationOSMesaGL: |
| 100 return InitializeGLSurface( | 101 format.SetDefaultPixelLayout(GLSurfaceFormat::PIXEL_LAYOUT_RGBA); |
| 101 new GLSurfaceOSMesa(GLSurface::SURFACE_OSMESA_RGBA, size)); | 102 return InitializeGLSurfaceWithFormat( |
| 103 new GLSurfaceOSMesa(format, size), format); |
| 102 case kGLImplementationEGLGLES2: | 104 case kGLImplementationEGLGLES2: |
| 103 return InitializeGLSurface(new PbufferGLSurfaceEGL(size)); | 105 return InitializeGLSurfaceWithFormat( |
| 106 new PbufferGLSurfaceEGL(size), format); |
| 104 case kGLImplementationDesktopGL: | 107 case kGLImplementationDesktopGL: |
| 105 return InitializeGLSurface(new PbufferGLSurfaceWGL(size)); | 108 return InitializeGLSurfaceWithFormat( |
| 109 new PbufferGLSurfaceWGL(size), format); |
| 106 case kGLImplementationMockGL: | 110 case kGLImplementationMockGL: |
| 107 return new GLSurfaceStub; | 111 return new GLSurfaceStub; |
| 108 default: | 112 default: |
| 109 NOTREACHED(); | 113 NOTREACHED(); |
| 110 return nullptr; | 114 return nullptr; |
| 111 } | 115 } |
| 112 } | 116 } |
| 113 | 117 |
| 114 } // namespace init | 118 } // namespace init |
| 115 } // namespace gl | 119 } // namespace gl |
| OLD | NEW |