gpu_memory_buffer_impl_surface_texture.h revision e5d81f57cb97b3b6b7fccc9c5610d21eb81db09d
1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ 6#define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ 7 8#include "content/common/gpu/client/gpu_memory_buffer_impl.h" 9 10struct ANativeWindow; 11 12namespace content { 13 14// Provides implementation of a GPU memory buffer based on a surface texture id. 15class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { 16 public: 17 GpuMemoryBufferImplSurfaceTexture(gfx::Size size, unsigned internalformat); 18 virtual ~GpuMemoryBufferImplSurfaceTexture(); 19 20 bool Initialize(gfx::GpuMemoryBufferHandle handle); 21 22 static bool IsFormatSupported(unsigned internalformat); 23 static int WindowFormat(unsigned internalformat); 24 25 // Overridden from gfx::GpuMemoryBuffer: 26 virtual void* Map(AccessMode mode) OVERRIDE; 27 virtual void Unmap() OVERRIDE; 28 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; 29 virtual uint32 GetStride() const OVERRIDE; 30 31 private: 32 gfx::SurfaceTextureId surface_texture_id_; 33 ANativeWindow* native_window_; 34 size_t stride_; 35 36 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); 37}; 38 39} // namespace content 40 41#endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ 42