| 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 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ |
| 7 | 7 |
| 8 #include "base/mac/scoped_cftyperef.h" | 8 #include "base/mac/scoped_cftyperef.h" |
| 9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| 10 | 10 |
| 11 class IOSurfaceSupport; | 11 class IOSurfaceSupport; |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 // Provides implementation of a GPU memory buffer based | 15 // Implementation of GPU memory buffer based on IO surfaces. |
| 16 // on an IO surface handle. | |
| 17 class GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl { | 16 class GpuMemoryBufferImplIOSurface : public GpuMemoryBufferImpl { |
| 18 public: | 17 public: |
| 19 GpuMemoryBufferImplIOSurface(gfx::Size size, unsigned internalformat); | 18 GpuMemoryBufferImplIOSurface(gfx::Size size, unsigned internalformat); |
| 20 virtual ~GpuMemoryBufferImplIOSurface(); | 19 virtual ~GpuMemoryBufferImplIOSurface(); |
| 21 | 20 |
| 22 static bool IsFormatSupported(unsigned internalformat); | 21 static bool IsFormatSupported(unsigned internalformat); |
| 23 static uint32 PixelFormat(unsigned internalformat); | 22 static uint32 PixelFormat(unsigned internalformat); |
| 24 | 23 |
| 25 bool Initialize(gfx::GpuMemoryBufferHandle handle); | 24 bool InitializeFromHandle(gfx::GpuMemoryBufferHandle handle); |
| 26 | 25 |
| 27 // Overridden from gfx::GpuMemoryBuffer: | 26 // Overridden from gfx::GpuMemoryBuffer: |
| 28 virtual void* Map(AccessMode mode) OVERRIDE; | 27 virtual void* Map(AccessMode mode) OVERRIDE; |
| 29 virtual void Unmap() OVERRIDE; | 28 virtual void Unmap() OVERRIDE; |
| 30 virtual uint32 GetStride() const OVERRIDE; | 29 virtual uint32 GetStride() const OVERRIDE; |
| 31 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; | 30 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; |
| 32 | 31 |
| 33 private: | 32 private: |
| 34 IOSurfaceSupport* io_surface_support_; | 33 IOSurfaceSupport* io_surface_support_; |
| 35 base::ScopedCFTypeRef<CFTypeRef> io_surface_; | 34 base::ScopedCFTypeRef<CFTypeRef> io_surface_; |
| 36 | 35 |
| 37 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); | 36 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplIOSurface); |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 } // namespace content | 39 } // namespace content |
| 41 | 40 |
| 42 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ | 41 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_IO_SURFACE_H_ |
| OLD | NEW |