| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ |
| 6 #define GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "gpu/gpu_export.h" | 9 #include "gpu/gpu_export.h" |
| 10 #include "gpu/ipc/common/surface_handle.h" |
| 10 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
| 11 #include "ui/gfx/gpu_memory_buffer.h" | 12 #include "ui/gfx/gpu_memory_buffer.h" |
| 12 | 13 |
| 13 namespace gl { | 14 namespace gl { |
| 14 class GLImage; | 15 class GLImage; |
| 15 } | 16 } |
| 16 | 17 |
| 17 namespace gpu { | 18 namespace gpu { |
| 18 | 19 |
| 19 class GPU_EXPORT ImageFactory { | 20 class GPU_EXPORT ImageFactory { |
| 20 public: | 21 public: |
| 21 ImageFactory(); | 22 ImageFactory(); |
| 22 | 23 |
| 23 // Creates a GLImage instance for GPU memory buffer identified by |handle|. | 24 // Creates a GLImage instance for GPU memory buffer identified by |handle|. |
| 24 // |client_id| should be set to the client requesting the creation of instance | 25 // |client_id| should be set to the client requesting the creation of instance |
| 25 // and can be used by factory implementation to verify access rights. | 26 // and can be used by factory implementation to verify access rights. |
| 26 virtual scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( | 27 virtual scoped_refptr<gl::GLImage> CreateImageForGpuMemoryBuffer( |
| 27 const gfx::GpuMemoryBufferHandle& handle, | 28 const gfx::GpuMemoryBufferHandle& handle, |
| 28 const gfx::Size& size, | 29 const gfx::Size& size, |
| 29 gfx::BufferFormat format, | 30 gfx::BufferFormat format, |
| 30 unsigned internalformat, | 31 unsigned internalformat, |
| 31 int client_id) = 0; | 32 int client_id, |
| 33 SurfaceHandle surface_handle) = 0; |
| 32 | 34 |
| 33 // Create an anonymous GLImage backed by a GpuMemoryBuffer that doesn't have a | 35 // Create an anonymous GLImage backed by a GpuMemoryBuffer that doesn't have a |
| 34 // client_id. It can't be passed to other processes. | 36 // client_id. It can't be passed to other processes. |
| 35 virtual scoped_refptr<gl::GLImage> CreateAnonymousImage( | 37 virtual scoped_refptr<gl::GLImage> CreateAnonymousImage( |
| 36 const gfx::Size& size, | 38 const gfx::Size& size, |
| 37 gfx::BufferFormat format, | 39 gfx::BufferFormat format, |
| 38 unsigned internalformat); | 40 unsigned internalformat); |
| 39 | 41 |
| 40 // An image can only be bound to a texture with the appropriate type. | 42 // An image can only be bound to a texture with the appropriate type. |
| 41 virtual unsigned RequiredTextureType(); | 43 virtual unsigned RequiredTextureType(); |
| 42 | 44 |
| 43 // Whether a created image can have format GL_RGB. | 45 // Whether a created image can have format GL_RGB. |
| 44 virtual bool SupportsFormatRGB(); | 46 virtual bool SupportsFormatRGB(); |
| 45 | 47 |
| 46 protected: | 48 protected: |
| 47 virtual ~ImageFactory(); | 49 virtual ~ImageFactory(); |
| 48 }; | 50 }; |
| 49 | 51 |
| 50 } // namespace gpu | 52 } // namespace gpu |
| 51 | 53 |
| 52 #endif // GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ | 54 #endif // GPU_COMMAND_BUFFER_SERVICE_IMAGE_FACTORY_H_ |
| OLD | NEW |