Upstream version 10.39.225.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(const gfx::GpuMemoryBufferId& id,
32                              const gfx::Size& size,
33                              unsigned internalformat,
34                              unsigned usage);
35
36   // Destroys GPU memory buffer identified by |id|.
37   void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId& id);
38
39   // Creates a GLImage instance for GPU memory buffer identified by |id|.
40   scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer(
41       const gfx::GpuMemoryBufferId& id,
42       const gfx::Size& size,
43       unsigned internalformat);
44
45  private:
46   BufferToPixmapMap native_pixmap_map_;
47 };
48
49 }  // namespace ui
50
51 #endif  // UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_BUFFER_H_