| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 717 } else { | 717 } else { |
| 718 scoped_refptr<GLSurface> surface = new GLSurfaceStub(); | 718 scoped_refptr<GLSurface> surface = new GLSurfaceStub(); |
| 719 if (surface->Initialize()) | 719 if (surface->Initialize()) |
| 720 return surface; | 720 return surface; |
| 721 } | 721 } |
| 722 return nullptr; | 722 return nullptr; |
| 723 } | 723 } |
| 724 | 724 |
| 725 // static | 725 // static |
| 726 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( | 726 scoped_refptr<GLSurface> GLSurface::CreateOffscreenGLSurface( |
| 727 const gfx::Size& size, GLSurface::Format format) { | 727 const gfx::Size& size) { |
| 728 switch (GetGLImplementation()) { | 728 switch (GetGLImplementation()) { |
| 729 case kGLImplementationOSMesaGL: { | 729 case kGLImplementationOSMesaGL: { |
| 730 scoped_refptr<GLSurface> surface( | 730 scoped_refptr<GLSurface> surface( |
| 731 new GLSurfaceOSMesa(OSMesaSurfaceFormatBGRA, size)); | 731 new GLSurfaceOSMesa(SURFACE_OSMESA_BGRA, size)); |
| 732 if (!surface->Initialize(format)) | 732 if (!surface->Initialize()) |
| 733 return nullptr; | 733 return nullptr; |
| 734 | 734 |
| 735 return surface; | 735 return surface; |
| 736 } | 736 } |
| 737 case kGLImplementationEGLGLES2: { | 737 case kGLImplementationEGLGLES2: { |
| 738 scoped_refptr<GLSurface> surface; | 738 scoped_refptr<GLSurface> surface; |
| 739 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && | 739 if (GLSurfaceEGL::IsEGLSurfacelessContextSupported() && |
| 740 (size.width() == 0 && size.height() == 0)) { | 740 (size.width() == 0 && size.height() == 0)) { |
| 741 surface = new SurfacelessEGL(size); | 741 surface = new SurfacelessEGL(size); |
| 742 } else { | 742 } else { |
| 743 surface = new PbufferGLSurfaceEGL(size); | 743 surface = new PbufferGLSurfaceEGL(size); |
| 744 } | 744 } |
| 745 | 745 |
| 746 if (!surface->Initialize(format)) | 746 if (!surface->Initialize()) |
| 747 return nullptr; | 747 return nullptr; |
| 748 return surface; | 748 return surface; |
| 749 } | 749 } |
| 750 case kGLImplementationMockGL: | 750 case kGLImplementationMockGL: |
| 751 return new GLSurfaceStub; | 751 return new GLSurfaceStub; |
| 752 default: | 752 default: |
| 753 NOTREACHED(); | 753 NOTREACHED(); |
| 754 return nullptr; | 754 return nullptr; |
| 755 } | 755 } |
| 756 } | 756 } |
| 757 | 757 |
| 758 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { | 758 EGLNativeDisplayType GetPlatformDefaultEGLNativeDisplay() { |
| 759 return ui::OzonePlatform::GetInstance() | 759 return ui::OzonePlatform::GetInstance() |
| 760 ->GetSurfaceFactoryOzone() | 760 ->GetSurfaceFactoryOzone() |
| 761 ->GetNativeDisplay(); | 761 ->GetNativeDisplay(); |
| 762 } | 762 } |
| 763 | 763 |
| 764 } // namespace gfx | 764 } // namespace gfx |
| OLD | NEW |