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 "content/common/gpu/client/gpu_memory_buffer_impl.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/numerics/safe_math.h" | 8 #include "base/numerics/safe_math.h" |
9 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | 9 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
11 | 11 |
12 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) |
13 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" | 13 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" |
14 #endif | 14 #endif |
15 | 15 |
16 #if defined(OS_ANDROID) | 16 #if defined(OS_ANDROID) |
17 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | 17 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" |
18 #endif | 18 #endif |
19 | 19 |
20 #if defined(USE_OZONE) | 20 #if defined(USE_OZONE) |
21 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h
" | 21 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h
" |
22 #endif | 22 #endif |
23 | 23 |
24 namespace content { | 24 namespace content { |
25 | 25 |
26 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | 26 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, |
27 const gfx::Size& size, | 27 const gfx::Size& size, |
28 Format format, | 28 Format format, |
29 const DestructionCallback& callback) | 29 const DestructionCallback& callback) |
30 : id_(id), | 30 : id_(id), |
31 size_(size), | 31 size_(size), |
(...skipping 23 matching lines...) Expand all Loading... |
55 case gfx::IO_SURFACE_BUFFER: | 55 case gfx::IO_SURFACE_BUFFER: |
56 return GpuMemoryBufferImplIOSurface::CreateFromHandle( | 56 return GpuMemoryBufferImplIOSurface::CreateFromHandle( |
57 handle, size, format, usage, callback); | 57 handle, size, format, usage, callback); |
58 #endif | 58 #endif |
59 #if defined(OS_ANDROID) | 59 #if defined(OS_ANDROID) |
60 case gfx::SURFACE_TEXTURE_BUFFER: | 60 case gfx::SURFACE_TEXTURE_BUFFER: |
61 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( | 61 return GpuMemoryBufferImplSurfaceTexture::CreateFromHandle( |
62 handle, size, format, callback); | 62 handle, size, format, callback); |
63 #endif | 63 #endif |
64 #if defined(USE_OZONE) | 64 #if defined(USE_OZONE) |
65 case gfx::OZONE_NATIVE_BUFFER: | 65 case gfx::OZONE_NATIVE_PIXMAP: |
66 return GpuMemoryBufferImplOzoneNativeBuffer::CreateFromHandle( | 66 return GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( |
67 handle, size, format, usage, callback); | 67 handle, size, format, usage, callback); |
68 #endif | 68 #endif |
69 default: | 69 default: |
70 NOTREACHED(); | 70 NOTREACHED(); |
71 return nullptr; | 71 return nullptr; |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 // static | 75 // static |
76 GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer( | 76 GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer( |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 | 203 |
204 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { | 204 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { |
205 return id_; | 205 return id_; |
206 } | 206 } |
207 | 207 |
208 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 208 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
209 return reinterpret_cast<ClientBuffer>(this); | 209 return reinterpret_cast<ClientBuffer>(this); |
210 } | 210 } |
211 | 211 |
212 } // namespace content | 212 } // namespace content |
OLD | NEW |