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 #include "content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.h" | 5 #include "content/common/gpu/gpu_memory_buffer_factory_x11_pixmap.h" |
6 | 6 |
7 #include "ui/gl/gl_image_glx.h" | 7 #include "ui/gl/gl_image_glx.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 | 32 |
33 scoped_refptr<gfx::GLImage> | 33 scoped_refptr<gfx::GLImage> |
34 GpuMemoryBufferFactoryX11Pixmap::AcquireImageForGpuMemoryBuffer( | 34 GpuMemoryBufferFactoryX11Pixmap::AcquireImageForGpuMemoryBuffer( |
35 const gfx::GpuMemoryBufferId& id, | 35 const gfx::GpuMemoryBufferId& id, |
36 const gfx::Size& size, | 36 const gfx::Size& size, |
37 unsigned internalformat) { | 37 unsigned internalformat) { |
38 X11PixmapMapKey key(id.primary_id, id.secondary_id); | 38 X11PixmapMapKey key(id.primary_id, id.secondary_id); |
39 X11PixmapMap::iterator it = pixmaps_.find(key); | 39 X11PixmapMap::iterator it = pixmaps_.find(key); |
40 if (it == pixmaps_.end()) | 40 if (it == pixmaps_.end()) |
41 return scoped_refptr<gfx::GLImage>(); | 41 return scoped_refptr<gfx::GLImage>(); |
42 XID pixmap = it->second; | |
43 pixmaps_.erase(it); | |
44 | 42 |
45 scoped_refptr<gfx::GLImageGLX> image( | 43 scoped_refptr<gfx::GLImageGLX> image( |
46 new gfx::GLImageGLX(size, internalformat)); | 44 new gfx::GLImageGLX(size, internalformat)); |
47 if (!image->Initialize(pixmap)) | 45 if (!image->Initialize(it->second)) |
48 return scoped_refptr<gfx::GLImage>(); | 46 return scoped_refptr<gfx::GLImage>(); |
49 | 47 |
50 return image; | 48 return image; |
51 } | 49 } |
52 | 50 |
53 } // namespace content | 51 } // namespace content |
OLD | NEW |