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 "content/common/gpu/image_transport_surface.h" | 5 #include "gpu/ipc/service/image_transport_surface.h" |
6 | 6 |
7 #include "content/common/gpu/child_window_surface_win.h" | 7 #include "gpu/ipc/service/child_window_surface_win.h" |
8 #include "content/common/gpu/pass_through_image_transport_surface.h" | 8 #include "gpu/ipc/service/pass_through_image_transport_surface.h" |
9 #include "ui/gfx/native_widget_types.h" | 9 #include "ui/gfx/native_widget_types.h" |
10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
11 #include "ui/gl/gl_implementation.h" | 11 #include "ui/gl/gl_implementation.h" |
12 #include "ui/gl/gl_surface_egl.h" | 12 #include "ui/gl/gl_surface_egl.h" |
13 #include "ui/gl/vsync_provider_win.h" | 13 #include "ui/gl/vsync_provider_win.h" |
14 | 14 |
15 namespace content { | 15 namespace gpu { |
16 | 16 |
17 // static | 17 // static |
18 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( | 18 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( |
19 GpuChannelManager* manager, | 19 GpuChannelManager* manager, |
20 GpuCommandBufferStub* stub, | 20 GpuCommandBufferStub* stub, |
21 gpu::SurfaceHandle surface_handle, | 21 SurfaceHandle surface_handle, |
22 gfx::GLSurface::Format format) { | 22 gfx::GLSurface::Format format) { |
23 DCHECK_NE(surface_handle, gpu::kNullSurfaceHandle); | 23 DCHECK_NE(surface_handle, kNullSurfaceHandle); |
24 | 24 |
25 scoped_refptr<gfx::GLSurface> surface; | 25 scoped_refptr<gfx::GLSurface> surface; |
26 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && | 26 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && |
27 gfx::GLSurfaceEGL::IsDirectCompositionSupported()) { | 27 gfx::GLSurfaceEGL::IsDirectCompositionSupported()) { |
28 scoped_refptr<ChildWindowSurfaceWin> egl_surface( | 28 scoped_refptr<ChildWindowSurfaceWin> egl_surface( |
29 new ChildWindowSurfaceWin(manager, surface_handle)); | 29 new ChildWindowSurfaceWin(manager, surface_handle)); |
30 surface = egl_surface; | 30 surface = egl_surface; |
31 | 31 |
32 // TODO(jbauman): Get frame statistics from DirectComposition | 32 // TODO(jbauman): Get frame statistics from DirectComposition |
33 scoped_ptr<gfx::VSyncProvider> vsync_provider( | 33 scoped_ptr<gfx::VSyncProvider> vsync_provider( |
34 new gfx::VSyncProviderWin(surface_handle)); | 34 new gfx::VSyncProviderWin(surface_handle)); |
35 if (!egl_surface->Initialize(std::move(vsync_provider))) | 35 if (!egl_surface->Initialize(std::move(vsync_provider))) |
36 return nullptr; | 36 return nullptr; |
37 } else { | 37 } else { |
38 surface = gfx::GLSurface::CreateViewGLSurface(surface_handle); | 38 surface = gfx::GLSurface::CreateViewGLSurface(surface_handle); |
39 if (!surface) | 39 if (!surface) |
40 return nullptr; | 40 return nullptr; |
41 } | 41 } |
42 | 42 |
43 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 43 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
44 manager, stub, surface.get())); | 44 manager, stub, surface.get())); |
45 } | 45 } |
46 | 46 |
47 } // namespace content | 47 } // namespace gpu |
OLD | NEW |