| 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_io_surface.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h" |
| 6 | 6 |
| 7 #include "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "content/common/gpu/client/gpu_memory_buffer_factory_host.h" | 10 #include "content/common/gpu/client/gpu_memory_buffer_factory_host.h" |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 case GL_BGRA8_EXT: | 138 case GL_BGRA8_EXT: |
| 139 return 'BGRA'; | 139 return 'BGRA'; |
| 140 default: | 140 default: |
| 141 NOTREACHED(); | 141 NOTREACHED(); |
| 142 return 0; | 142 return 0; |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 | 145 |
| 146 void* GpuMemoryBufferImplIOSurface::Map() { | 146 void* GpuMemoryBufferImplIOSurface::Map() { |
| 147 DCHECK(!mapped_); | 147 DCHECK(!mapped_); |
| 148 IOSurfaceLock(io_surface_, 0, NULL); | 148 IOSurfaceLock(io_surface_, 0, nullptr); |
| 149 mapped_ = true; | 149 mapped_ = true; |
| 150 return IOSurfaceGetBaseAddress(io_surface_); | 150 return IOSurfaceGetBaseAddress(io_surface_); |
| 151 } | 151 } |
| 152 | 152 |
| 153 void GpuMemoryBufferImplIOSurface::Unmap() { | 153 void GpuMemoryBufferImplIOSurface::Unmap() { |
| 154 DCHECK(mapped_); | 154 DCHECK(mapped_); |
| 155 IOSurfaceUnlock(io_surface_, 0, NULL); | 155 IOSurfaceUnlock(io_surface_, 0, nullptr); |
| 156 mapped_ = false; | 156 mapped_ = false; |
| 157 } | 157 } |
| 158 | 158 |
| 159 uint32 GpuMemoryBufferImplIOSurface::GetStride() const { | 159 uint32 GpuMemoryBufferImplIOSurface::GetStride() const { |
| 160 return IOSurfaceGetBytesPerRow(io_surface_); | 160 return IOSurfaceGetBytesPerRow(io_surface_); |
| 161 } | 161 } |
| 162 | 162 |
| 163 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { | 163 gfx::GpuMemoryBufferHandle GpuMemoryBufferImplIOSurface::GetHandle() const { |
| 164 gfx::GpuMemoryBufferHandle handle; | 164 gfx::GpuMemoryBufferHandle handle; |
| 165 handle.type = gfx::IO_SURFACE_BUFFER; | 165 handle.type = gfx::IO_SURFACE_BUFFER; |
| 166 handle.io_surface_id = IOSurfaceGetID(io_surface_); | 166 handle.io_surface_id = IOSurfaceGetID(io_surface_); |
| 167 return handle; | 167 return handle; |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace content | 170 } // namespace content |
| OLD | NEW |