| 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 "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h" | 5 #include "gpu/ipc/service/gpu_memory_buffer_factory_native_pixmap.h" |
| 6 | 6 |
| 7 #include "ui/gfx/client_native_pixmap.h" | 7 #include "ui/gfx/client_native_pixmap.h" |
| 8 #include "ui/gfx/native_pixmap.h" | 8 #include "ui/gfx/native_pixmap.h" |
| 9 #include "ui/gl/gl_image_native_pixmap.h" | 9 #include "ui/gl/gl_image_native_pixmap.h" |
| 10 | 10 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 << static_cast<int>(format); | 124 << static_cast<int>(format); |
| 125 return nullptr; | 125 return nullptr; |
| 126 } | 126 } |
| 127 return image; | 127 return image; |
| 128 } | 128 } |
| 129 | 129 |
| 130 scoped_refptr<gl::GLImage> | 130 scoped_refptr<gl::GLImage> |
| 131 GpuMemoryBufferFactoryNativePixmap::CreateAnonymousImage( | 131 GpuMemoryBufferFactoryNativePixmap::CreateAnonymousImage( |
| 132 const gfx::Size& size, | 132 const gfx::Size& size, |
| 133 gfx::BufferFormat format, | 133 gfx::BufferFormat format, |
| 134 gfx::BufferUsage usage, | |
| 135 unsigned internalformat) { | 134 unsigned internalformat) { |
| 136 scoped_refptr<gfx::NativePixmap> pixmap; | 135 scoped_refptr<gfx::NativePixmap> pixmap; |
| 137 #if defined(USE_OZONE) | 136 #if defined(USE_OZONE) |
| 138 pixmap = | 137 pixmap = ui::OzonePlatform::GetInstance() |
| 139 ui::OzonePlatform::GetInstance() | 138 ->GetSurfaceFactoryOzone() |
| 140 ->GetSurfaceFactoryOzone() | 139 ->CreateNativePixmap(gpu::kNullSurfaceHandle, size, format, |
| 141 ->CreateNativePixmap(gpu::kNullSurfaceHandle, size, format, usage); | 140 gfx::BufferUsage::SCANOUT); |
| 142 #else | 141 #else |
| 143 NOTIMPLEMENTED(); | 142 NOTIMPLEMENTED(); |
| 144 #endif | 143 #endif |
| 145 if (!pixmap.get()) { | 144 if (!pixmap.get()) { |
| 146 LOG(ERROR) << "Failed to create pixmap " << size.ToString() << " format " | 145 LOG(ERROR) << "Failed to create pixmap " << size.ToString() << " format " |
| 147 << static_cast<int>(format); | 146 << static_cast<int>(format); |
| 148 return nullptr; | 147 return nullptr; |
| 149 } | 148 } |
| 150 scoped_refptr<gl::GLImageNativePixmap> image( | 149 scoped_refptr<gl::GLImageNativePixmap> image( |
| 151 new gl::GLImageNativePixmap(size, internalformat)); | 150 new gl::GLImageNativePixmap(size, internalformat)); |
| 152 if (!image->Initialize(pixmap.get(), format)) { | 151 if (!image->Initialize(pixmap.get(), format)) { |
| 153 LOG(ERROR) << "Failed to create GLImage " << size.ToString() << " format " | 152 LOG(ERROR) << "Failed to create GLImage " << size.ToString() << " format " |
| 154 << static_cast<int>(format); | 153 << static_cast<int>(format); |
| 155 return nullptr; | 154 return nullptr; |
| 156 } | 155 } |
| 157 return image; | 156 return image; |
| 158 } | 157 } |
| 159 | 158 |
| 160 unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() { | 159 unsigned GpuMemoryBufferFactoryNativePixmap::RequiredTextureType() { |
| 161 return GL_TEXTURE_2D; | 160 return GL_TEXTURE_2D; |
| 162 } | 161 } |
| 163 | 162 |
| 164 } // namespace gpu | 163 } // namespace gpu |
| OLD | NEW |