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_io_surface.h" | 5 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 GpuMemoryBufferFactoryIOSurface::~GpuMemoryBufferFactoryIOSurface() { | 93 GpuMemoryBufferFactoryIOSurface::~GpuMemoryBufferFactoryIOSurface() { |
94 } | 94 } |
95 | 95 |
96 // static | 96 // static |
97 bool GpuMemoryBufferFactoryIOSurface::IsGpuMemoryBufferConfigurationSupported( | 97 bool GpuMemoryBufferFactoryIOSurface::IsGpuMemoryBufferConfigurationSupported( |
98 gfx::BufferFormat format, | 98 gfx::BufferFormat format, |
99 gfx::BufferUsage usage) { | 99 gfx::BufferUsage usage) { |
100 switch (usage) { | 100 switch (usage) { |
101 case gfx::BufferUsage::GPU_READ: | 101 case gfx::BufferUsage::GPU_READ: |
102 case gfx::BufferUsage::GPU_READ_WRITE: | 102 case gfx::BufferUsage::SCANOUT: |
103 return format == gfx::BufferFormat::BGRA_8888 || | 103 return format == gfx::BufferFormat::BGRA_8888 || |
104 format == gfx::BufferFormat::RGBA_8888; | 104 format == gfx::BufferFormat::RGBA_8888; |
105 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: | 105 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE: |
106 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: | 106 case gfx::BufferUsage::GPU_READ_CPU_READ_WRITE_PERSISTENT: |
107 return format == gfx::BufferFormat::R_8 || | 107 return format == gfx::BufferFormat::R_8 || |
108 format == gfx::BufferFormat::BGRA_8888 || | 108 format == gfx::BufferFormat::BGRA_8888 || |
109 format == gfx::BufferFormat::UYVY_422 || | 109 format == gfx::BufferFormat::UYVY_422 || |
110 format == gfx::BufferFormat::YUV_420_BIPLANAR; | 110 format == gfx::BufferFormat::YUV_420_BIPLANAR; |
111 } | 111 } |
112 NOTREACHED(); | 112 NOTREACHED(); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 | 236 |
237 scoped_refptr<gl::GLImageIOSurface> image( | 237 scoped_refptr<gl::GLImageIOSurface> image( |
238 new gl::GLImageIOSurface(size, internalformat)); | 238 new gl::GLImageIOSurface(size, internalformat)); |
239 if (!image->Initialize(it->second.get(), handle.id, format)) | 239 if (!image->Initialize(it->second.get(), handle.id, format)) |
240 return scoped_refptr<gl::GLImage>(); | 240 return scoped_refptr<gl::GLImage>(); |
241 | 241 |
242 return image; | 242 return image; |
243 } | 243 } |
244 | 244 |
245 } // namespace content | 245 } // namespace content |
OLD | NEW |