OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/ipc/service/image_transport_surface.h" | 5 #include "gpu/ipc/service/image_transport_surface.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "gpu/ipc/service/child_window_surface_win.h" | 9 #include "gpu/ipc/service/child_window_surface_win.h" |
10 #include "gpu/ipc/service/pass_through_image_transport_surface.h" | 10 #include "gpu/ipc/service/pass_through_image_transport_surface.h" |
11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gl/gl_bindings.h" | 12 #include "ui/gl/gl_bindings.h" |
13 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
14 #include "ui/gl/gl_surface_egl.h" | 14 #include "ui/gl/gl_surface_egl.h" |
15 #include "ui/gl/init/gl_factory.h" | 15 #include "ui/gl/init/gl_factory.h" |
16 #include "ui/gl/vsync_provider_win.h" | 16 #include "ui/gl/vsync_provider_win.h" |
17 | 17 |
18 namespace gpu { | 18 namespace gpu { |
19 | 19 |
20 // static | 20 // static |
21 scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface( | 21 scoped_refptr<gl::GLSurface> ImageTransportSurface::CreateNativeSurface( |
22 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, | 22 base::WeakPtr<ImageTransportSurfaceDelegate> delegate, |
23 SurfaceHandle surface_handle, | 23 SurfaceHandle surface_handle, |
24 gl::GLSurface::Format format) { | 24 gl::GLSurfaceFormat format) { |
25 DCHECK_NE(surface_handle, kNullSurfaceHandle); | 25 DCHECK_NE(surface_handle, kNullSurfaceHandle); |
26 | 26 |
27 scoped_refptr<gl::GLSurface> surface; | 27 scoped_refptr<gl::GLSurface> surface; |
28 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && | 28 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && |
29 gl::GLSurfaceEGL::IsDirectCompositionSupported()) { | 29 gl::GLSurfaceEGL::IsDirectCompositionSupported()) { |
30 scoped_refptr<ChildWindowSurfaceWin> egl_surface( | 30 scoped_refptr<ChildWindowSurfaceWin> egl_surface( |
31 new ChildWindowSurfaceWin(delegate, surface_handle)); | 31 new ChildWindowSurfaceWin(delegate, surface_handle)); |
32 surface = egl_surface; | 32 surface = egl_surface; |
33 | 33 |
34 // TODO(stanisc): http://crbug.com/659844: | 34 // TODO(stanisc): http://crbug.com/659844: |
(...skipping 10 matching lines...) Expand all Loading... |
45 surface = gl::init::CreateViewGLSurface(surface_handle); | 45 surface = gl::init::CreateViewGLSurface(surface_handle); |
46 if (!surface) | 46 if (!surface) |
47 return nullptr; | 47 return nullptr; |
48 } | 48 } |
49 | 49 |
50 return scoped_refptr<gl::GLSurface>( | 50 return scoped_refptr<gl::GLSurface>( |
51 new PassThroughImageTransportSurface(delegate, surface.get())); | 51 new PassThroughImageTransportSurface(delegate, surface.get())); |
52 } | 52 } |
53 | 53 |
54 } // namespace gpu | 54 } // namespace gpu |
OLD | NEW |