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 "content/common/gpu/image_transport_surface.h" |
6 | 6 |
7 #include "content/common/gpu/texture_image_transport_surface.h" | 7 #include "content/common/gpu/texture_image_transport_surface.h" |
8 | 8 |
| 9 namespace content { |
| 10 |
9 // static | 11 // static |
10 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( | 12 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( |
11 GpuChannelManager* manager, | 13 GpuChannelManager* manager, |
12 GpuCommandBufferStub* stub, | 14 GpuCommandBufferStub* stub, |
13 const gfx::GLSurfaceHandle& handle) { | 15 const gfx::GLSurfaceHandle& handle) { |
14 scoped_refptr<gfx::GLSurface> surface; | 16 scoped_refptr<gfx::GLSurface> surface; |
15 if (!handle.handle) { | 17 if (!handle.handle) { |
16 DCHECK(handle.transport); | 18 DCHECK(handle.transport); |
17 DCHECK(handle.parent_client_id); | 19 DCHECK(handle.parent_client_id); |
18 surface = new TextureImageTransportSurface(manager, stub, handle); | 20 surface = new TextureImageTransportSurface(manager, stub, handle); |
19 } else { | 21 } else { |
20 surface = gfx::GLSurface::CreateViewGLSurface(false, handle.handle); | 22 surface = gfx::GLSurface::CreateViewGLSurface(false, handle.handle); |
21 if (!surface.get()) | 23 if (!surface.get()) |
22 return NULL; | 24 return NULL; |
23 surface = new PassThroughImageTransportSurface(manager, | 25 surface = new PassThroughImageTransportSurface(manager, |
24 stub, | 26 stub, |
25 surface.get(), | 27 surface.get(), |
26 handle.transport); | 28 handle.transport); |
27 } | 29 } |
28 | 30 |
29 if (surface->Initialize()) | 31 if (surface->Initialize()) |
30 return surface; | 32 return surface; |
31 else | 33 else |
32 return NULL; | 34 return NULL; |
33 } | 35 } |
| 36 |
| 37 } // namespace content |
OLD | NEW |