| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/ozone/platform/drm/gpu/gbm_surface.h" | 5 #include "ui/ozone/platform/drm/gpu/gbm_surface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/gfx/native_pixmap.h" | 10 #include "ui/gfx/native_pixmap.h" |
| 11 #include "ui/gl/gl_image_native_pixmap.h" |
| 11 #include "ui/gl/gl_surface_egl.h" | 12 #include "ui/gl/gl_surface_egl.h" |
| 12 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h" | |
| 13 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" | 13 #include "ui/ozone/platform/drm/gpu/drm_window_proxy.h" |
| 14 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" | 14 #include "ui/ozone/platform/drm/gpu/gbm_surface_factory.h" |
| 15 | 15 |
| 16 namespace ui { | 16 namespace ui { |
| 17 | 17 |
| 18 GbmSurface::GbmSurface(GbmSurfaceFactory* surface_factory, | 18 GbmSurface::GbmSurface(GbmSurfaceFactory* surface_factory, |
| 19 std::unique_ptr<DrmWindowProxy> window, | 19 std::unique_ptr<DrmWindowProxy> window, |
| 20 gfx::AcceleratedWidget widget) | 20 gfx::AcceleratedWidget widget) |
| 21 : GbmSurfaceless(surface_factory, std::move(window), widget) { | 21 : GbmSurfaceless(surface_factory, std::move(window), widget) { |
| 22 for (auto& texture : textures_) | 22 for (auto& texture : textures_) |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 bool GbmSurface::CreatePixmaps() { | 121 bool GbmSurface::CreatePixmaps() { |
| 122 if (!fbo_) | 122 if (!fbo_) |
| 123 return true; | 123 return true; |
| 124 for (size_t i = 0; i < arraysize(textures_); i++) { | 124 for (size_t i = 0; i < arraysize(textures_); i++) { |
| 125 scoped_refptr<NativePixmap> pixmap = surface_factory()->CreateNativePixmap( | 125 scoped_refptr<NativePixmap> pixmap = surface_factory()->CreateNativePixmap( |
| 126 widget(), GetSize(), gfx::BufferFormat::BGRA_8888, | 126 widget(), GetSize(), gfx::BufferFormat::BGRA_8888, |
| 127 gfx::BufferUsage::SCANOUT); | 127 gfx::BufferUsage::SCANOUT); |
| 128 if (!pixmap) | 128 if (!pixmap) |
| 129 return false; | 129 return false; |
| 130 scoped_refptr<GLImageOzoneNativePixmap> image = | 130 scoped_refptr<GLImageNativePixmap> image = |
| 131 new GLImageOzoneNativePixmap(GetSize(), GL_BGRA_EXT); | 131 new GLImageNativePixmap(GetSize(), GL_BGRA_EXT); |
| 132 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888)) | 132 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888)) |
| 133 return false; | 133 return false; |
| 134 images_[i] = image; | 134 images_[i] = image; |
| 135 // Bind image to texture. | 135 // Bind image to texture. |
| 136 gl::ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); | 136 gl::ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); |
| 137 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) | 137 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) |
| 138 return false; | 138 return false; |
| 139 } | 139 } |
| 140 return true; | 140 return true; |
| 141 } | 141 } |
| 142 | 142 |
| 143 } // namespace ui | 143 } // namespace ui |
| OLD | NEW |