| 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_stub.h" | 10 #include "ui/gl/gl_context_stub.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 if (HasGLOzone()) | 78 if (HasGLOzone()) |
| 79 return GetGLOzone()->CreateSurfacelessViewGLSurface(window); | 79 return GetGLOzone()->CreateSurfacelessViewGLSurface(window); |
| 80 | 80 |
| 81 return nullptr; | 81 return nullptr; |
| 82 } | 82 } |
| 83 | 83 |
| 84 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( | 84 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( |
| 85 const gfx::Size& size, GLSurfaceFormat format) { | 85 const gfx::Size& size, GLSurfaceFormat format) { |
| 86 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); | 86 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); |
| 87 | 87 |
| 88 if (!format.IsDefault()) { | 88 if (!format.IsCompatible(GLSurfaceFormat())) { |
| 89 NOTREACHED() << "FATAL: Ozone only supports default-format surfaces."; | 89 NOTREACHED() << "FATAL: Ozone only supports default-format surfaces."; |
| 90 return nullptr; | 90 return nullptr; |
| 91 } | 91 } |
| 92 | 92 |
| 93 if (HasGLOzone()) | 93 if (HasGLOzone()) |
| 94 return GetGLOzone()->CreateOffscreenGLSurface(size); | 94 return GetGLOzone()->CreateOffscreenGLSurface(size); |
| 95 | 95 |
| 96 switch (GetGLImplementation()) { | 96 switch (GetGLImplementation()) { |
| 97 case kGLImplementationMockGL: | 97 case kGLImplementationMockGL: |
| 98 case kGLImplementationStubGL: | 98 case kGLImplementationStubGL: |
| 99 return InitializeGLSurface(new GLSurfaceStub); | 99 return InitializeGLSurface(new GLSurfaceStub); |
| 100 default: | 100 default: |
| 101 NOTREACHED(); | 101 NOTREACHED(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 return nullptr; | 104 return nullptr; |
| 105 } | 105 } |
| 106 | 106 |
| 107 } // namespace init | 107 } // namespace init |
| 108 } // namespace gl | 108 } // namespace gl |
| OLD | NEW |