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.
5 #ifndef CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_X11_PIXMAP_H_
6 #define CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_X11_PIXMAP_H_
8 #include "base/containers/hash_tables.h"
9 #include "base/memory/ref_counted.h"
10 #include "ui/gfx/geometry/size.h"
11 #include "ui/gfx/gpu_memory_buffer.h"
12 #include "ui/gfx/x/x11_types.h"
20 class GpuMemoryBufferFactoryX11Pixmap
{
22 GpuMemoryBufferFactoryX11Pixmap();
23 ~GpuMemoryBufferFactoryX11Pixmap();
25 // Create a GPU memory buffer for an existing X11 pixmap.
26 void CreateGpuMemoryBuffer(const gfx::GpuMemoryBufferId
& id
, XID pixmap
);
28 // Destroy a previously created GPU memory buffer.
29 void DestroyGpuMemoryBuffer(const gfx::GpuMemoryBufferId
& id
);
31 // Creates a GLImage instance for a GPU memory buffer.
32 scoped_refptr
<gfx::GLImage
> CreateImageForGpuMemoryBuffer(
33 const gfx::GpuMemoryBufferId
& id
,
34 const gfx::Size
& size
,
35 unsigned internalformat
);
38 typedef std::pair
<int, int> X11PixmapMapKey
;
39 typedef base::hash_map
<X11PixmapMapKey
, XID
> X11PixmapMap
;
40 X11PixmapMap pixmaps_
;
43 } // namespace content
45 #endif // CONTENT_COMMON_GPU_GPU_MEMORY_BUFFER_FACTORY_X11_PIXMAP_H_