OLD | NEW |
| (Empty) |
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_PIXMAP_H_ | |
6 #define UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/synchronization/lock.h" | |
12 #include "ui/gfx/geometry/size.h" | |
13 #include "ui/gfx/gpu_memory_buffer.h" | |
14 #include "ui/gfx/native_widget_types.h" | |
15 #include "ui/ozone/gpu/ozone_gpu_export.h" | |
16 #include "ui/ozone/public/native_pixmap.h" | |
17 | |
18 namespace gfx { | |
19 class GLImage; | |
20 } | |
21 | |
22 namespace ui { | |
23 class NativePixmap; | |
24 | |
25 class OZONE_GPU_EXPORT GpuMemoryBufferFactoryOzoneNativePixmap { | |
26 typedef std::map<std::pair<uint32_t, uint32_t>, scoped_refptr<NativePixmap>> | |
27 BufferToPixmapMap; | |
28 | |
29 public: | |
30 GpuMemoryBufferFactoryOzoneNativePixmap(); | |
31 virtual ~GpuMemoryBufferFactoryOzoneNativePixmap(); | |
32 | |
33 // Creates a GPU memory buffer identified by |id|. | |
34 // It can be called on any thread. | |
35 bool CreateGpuMemoryBuffer(gfx::GpuMemoryBufferId id, | |
36 const gfx::Size& size, | |
37 gfx::GpuMemoryBuffer::Format format, | |
38 gfx::GpuMemoryBuffer::Usage usage, | |
39 int client_id, | |
40 gfx::PluginWindowHandle surface_handle); | |
41 | |
42 // Destroys GPU memory buffer identified by |id|. | |
43 // It can be called on any thread. | |
44 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, int client_id); | |
45 | |
46 // Creates a GLImage instance for GPU memory buffer identified by |id|. | |
47 scoped_refptr<gfx::GLImage> CreateImageForGpuMemoryBuffer( | |
48 gfx::GpuMemoryBufferId id, | |
49 const gfx::Size& size, | |
50 gfx::GpuMemoryBuffer::Format format, | |
51 unsigned internalformat, | |
52 int client_id); | |
53 | |
54 static scoped_refptr<gfx::GLImage> CreateImageForPixmap( | |
55 scoped_refptr<NativePixmap> pixmap, | |
56 const gfx::Size& size, | |
57 gfx::GpuMemoryBuffer::Format format, | |
58 unsigned internalformat); | |
59 | |
60 private: | |
61 BufferToPixmapMap native_pixmap_map_; | |
62 base::Lock native_pixmap_map_lock_; | |
63 }; | |
64 | |
65 } // namespace ui | |
66 | |
67 #endif // UI_OZONE_GPU_GPU_MEMORY_BUFFER_FACTORY_OZONE_NATIVE_PIXMAP_H_ | |
OLD | NEW |