Chromium Code Reviews| Index: gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc |
| diff --git a/gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc b/gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc |
| index e59f155c6ee0413af8179a103f02bab0f1c3bbc6..f35df29591e33046b6014e62ad2a6925e0f4def9 100644 |
| --- a/gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc |
| +++ b/gpu/ipc/service/gpu_memory_buffer_factory_ozone_native_pixmap.cc |
| @@ -115,4 +115,32 @@ GpuMemoryBufferFactoryOzoneNativePixmap::CreateImageForGpuMemoryBuffer( |
| return image; |
| } |
| +scoped_refptr<gl::GLImage> |
| +GpuMemoryBufferFactoryOzoneNativePixmap::CreateAnonymousImage( |
| + const gfx::Size& size, |
| + gfx::BufferFormat format, |
| + unsigned internalformat) { |
| + scoped_refptr<ui::NativePixmap> pixmap = |
| + ui::OzonePlatform::GetInstance() |
| + ->GetSurfaceFactoryOzone() |
| + ->CreateNativePixmap(gpu::kNullSurfaceHandle, size, format, |
| + gfx::BufferUsage::SCANOUT); |
| + if (!pixmap.get()) { |
| + LOG(ERROR) << "Failed to create pixmap " << size.width() << "x" |
| + << size.height() << " format " << static_cast<int>(format); |
|
Daniele Castagna
2017/01/14 22:55:49
nit: It'd be nice to have a string for the format
reveman
2017/01/14 23:23:46
Agreed but adding utility function for that is out
|
| + return nullptr; |
| + } |
| + scoped_refptr<ui::GLImageOzoneNativePixmap> image( |
| + new ui::GLImageOzoneNativePixmap(size, internalformat)); |
| + if (!image->Initialize(pixmap.get(), format)) { |
| + LOG(ERROR) << "Failed to create GLImage"; |
|
Daniele Castagna
2017/01/14 22:55:49
nit: format and size might still be useful here.
reveman
2017/01/14 23:23:46
Done.
|
| + return nullptr; |
| + } |
| + return image; |
| +} |
| + |
| +unsigned GpuMemoryBufferFactoryOzoneNativePixmap::RequiredTextureType() { |
| + return GL_TEXTURE_EXTERNAL_OES; |
| +} |
| + |
| } // namespace gpu |