Update To 11.40.268.0
[platform/framework/web/crosswalk.git] / src / ui / ozone / gpu / gpu_memory_buffer_factory_ozone_native_buffer.h
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 UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_
6 #define UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_
7
8 #include <map>
9
10 #include "base/memory/ref_counted.h"
11 #include "ui/gfx/geometry/size.h"
12 #include "ui/gfx/gpu_memory_buffer.h"
13 #include "ui/ozone/gpu/ozone_gpu_export.h"
14
15 namespace gfx {
16 class GLImage;
17 }
18
19 namespace ui {
20 class NativePixmap;
21
22 class OZONE_GPU_EXPORT GpuMemoryBufferFactoryOzoneNativeBuffer {
23   typedef std::map<std::pair<uint32_t, uint32_t>, scoped_refptr<NativePixmap> >
24       BufferToPixmapMap;
25
26  public:
27   GpuMemoryBufferFactoryOzoneNativeBuffer();
28   virtual ~GpuMemoryBufferFactoryOzoneNativeBuffer();
29
30   // Creates a GPU memory buffer identified by |id|.
31   bool CreateGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
32                              const gfx::Size& size,
33                              gfx::GpuMemoryBuffer::Format format,
34                              gfx::GpuMemoryBuffer::Usage usage,
35                              int client_id);
36
37   // Destroys GPU memory buffer identified by |id|.
38   void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id);
39
40   // Creates a GLImage instance for GPU memory buffer identified by |id|.
41   scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
42       gfx::GpuMemoryBufferId id,
43       const gfx::Size& size,
44       gfx::GpuMemoryBuffer::Format format,
45       unsigned internalformat,
46       int client_id);
47
48  private:
49   BufferToPixmapMap native_pixmap_map_;
50 };
51
52 }  // namespace ui
53
54 #endif  // UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_