OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/client/gpu_memory_buffer_impl.h" | 5 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" | 9 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" |
10 | 10 |
11 #if defined(OS_MACOSX) | 11 #if defined(OS_MACOSX) |
12 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h" | 12 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h" |
13 #endif | 13 #endif |
14 | 14 |
15 #if defined(OS_ANDROID) | |
16 #include "gpu/ipc/client/gpu_memory_buffer_impl_surface_texture.h" | |
17 #endif | |
18 | |
19 #if defined(USE_OZONE) | 15 #if defined(USE_OZONE) |
20 #include "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" | 16 #include "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" |
21 #endif | 17 #endif |
22 | 18 |
23 namespace gpu { | 19 namespace gpu { |
24 | 20 |
25 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | 21 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, |
26 const gfx::Size& size, | 22 const gfx::Size& size, |
27 gfx::BufferFormat format, | 23 gfx::BufferFormat format, |
28 const DestructionCallback& callback) | 24 const DestructionCallback& callback) |
(...skipping 17 matching lines...) Expand all Loading... |
46 const DestructionCallback& callback) { | 42 const DestructionCallback& callback) { |
47 switch (handle.type) { | 43 switch (handle.type) { |
48 case gfx::SHARED_MEMORY_BUFFER: | 44 case gfx::SHARED_MEMORY_BUFFER: |
49 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( | 45 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( |
50 handle, size, format, usage, callback); | 46 handle, size, format, usage, callback); |
51 #if defined(OS_MACOSX) | 47 #if defined(OS_MACOSX) |
52 case gfx::IO_SURFACE_BUFFER: | 48 case gfx::IO_SURFACE_BUFFER: |
53 return GpuMemoryBufferImplIOSurface::CreateFromHandle( | 49 return GpuMemoryBufferImplIOSurface::CreateFromHandle( |
54 handle, size, format, usage, callback); | 50 handle, size, format, usage, callback); |
55 #endif | 51 #endif |
56 #if defined(OS_ANDROID) | |
57 case gfx::SURFACE_TEXTURE_BUFFER: | |
58 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( | |
59 handle, size, format, usage, callback); | |
60 #endif | |
61 #if defined(USE_OZONE) | 52 #if defined(USE_OZONE) |
62 case gfx::OZONE_NATIVE_PIXMAP: | 53 case gfx::OZONE_NATIVE_PIXMAP: |
63 return GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( | 54 return GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( |
64 handle, size, format, usage, callback); | 55 handle, size, format, usage, callback); |
65 #endif | 56 #endif |
66 default: | 57 default: |
67 NOTREACHED(); | 58 NOTREACHED(); |
68 return nullptr; | 59 return nullptr; |
69 } | 60 } |
70 } | 61 } |
(...skipping 14 matching lines...) Expand all Loading... |
85 | 76 |
86 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { | 77 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { |
87 return id_; | 78 return id_; |
88 } | 79 } |
89 | 80 |
90 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 81 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
91 return reinterpret_cast<ClientBuffer>(this); | 82 return reinterpret_cast<ClientBuffer>(this); |
92 } | 83 } |
93 | 84 |
94 } // namespace gpu | 85 } // namespace gpu |
OLD | NEW |