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_surface_texture.h" | 5 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" |
6 | 6 |
7 #include "content/common/android/surface_texture_manager.h" | 7 #include "content/common/android/surface_texture_manager.h" |
8 #include "ui/gl/android/surface_texture.h" | 8 #include "ui/gl/android/surface_texture.h" |
9 #include "ui/gl/gl_image_surface_texture.h" | 9 #include "ui/gl/gl_image_surface_texture.h" |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, | 27 IsGpuMemoryBufferConfigurationSupported(gfx::BufferFormat format, |
28 gfx::BufferUsage usage) { | 28 gfx::BufferUsage usage) { |
29 for (auto& configuration : kSupportedConfigurations) { | 29 for (auto& configuration : kSupportedConfigurations) { |
30 if (configuration.format == format && configuration.usage == usage) | 30 if (configuration.format == format && configuration.usage == usage) |
31 return true; | 31 return true; |
32 } | 32 } |
33 | 33 |
34 return false; | 34 return false; |
35 } | 35 } |
36 | 36 |
37 void GpuMemoryBufferFactorySurfaceTexture:: | |
38 GetSupportedGpuMemoryBufferConfigurations( | |
39 std::vector<Configuration>* configurations) { | |
40 configurations->assign( | |
41 kSupportedConfigurations, | |
42 kSupportedConfigurations + arraysize(kSupportedConfigurations)); | |
43 } | |
44 | |
45 gfx::GpuMemoryBufferHandle | 37 gfx::GpuMemoryBufferHandle |
46 GpuMemoryBufferFactorySurfaceTexture::CreateGpuMemoryBuffer( | 38 GpuMemoryBufferFactorySurfaceTexture::CreateGpuMemoryBuffer( |
47 gfx::GpuMemoryBufferId id, | 39 gfx::GpuMemoryBufferId id, |
48 const gfx::Size& size, | 40 const gfx::Size& size, |
49 gfx::BufferFormat format, | 41 gfx::BufferFormat format, |
50 gfx::BufferUsage usage, | 42 gfx::BufferUsage usage, |
51 int client_id, | 43 int client_id, |
52 gfx::PluginWindowHandle surface_handle) { | 44 gfx::PluginWindowHandle surface_handle) { |
53 // Note: this needs to be 0 as the surface texture implemenation will take | 45 // Note: this needs to be 0 as the surface texture implemenation will take |
54 // ownership of the texture and call glDeleteTextures when the GPU service | 46 // ownership of the texture and call glDeleteTextures when the GPU service |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 106 |
115 scoped_refptr<gfx::GLImageSurfaceTexture> image( | 107 scoped_refptr<gfx::GLImageSurfaceTexture> image( |
116 new gfx::GLImageSurfaceTexture(size)); | 108 new gfx::GLImageSurfaceTexture(size)); |
117 if (!image->Initialize(it->second.get())) | 109 if (!image->Initialize(it->second.get())) |
118 return scoped_refptr<gfx::GLImage>(); | 110 return scoped_refptr<gfx::GLImage>(); |
119 | 111 |
120 return image; | 112 return image; |
121 } | 113 } |
122 | 114 |
123 } // namespace content | 115 } // namespace content |
OLD | NEW |