| 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" |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void GbmSurface::BindFramebuffer() { | 115 void GbmSurface::BindFramebuffer() { |
| 116 gl::ScopedFramebufferBinder fb(fbo_); | 116 gl::ScopedFramebufferBinder fb(fbo_); |
| 117 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 117 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
| 118 textures_[current_surface_], 0); | 118 textures_[current_surface_], 0); |
| 119 } | 119 } |
| 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<gfx::NativePixmap> pixmap = |
| 126 widget(), GetSize(), gfx::BufferFormat::BGRA_8888, | 126 surface_factory()->CreateNativePixmap(widget(), GetSize(), |
| 127 gfx::BufferUsage::SCANOUT); | 127 gfx::BufferFormat::BGRA_8888, |
| 128 gfx::BufferUsage::SCANOUT); |
| 128 if (!pixmap) | 129 if (!pixmap) |
| 129 return false; | 130 return false; |
| 130 scoped_refptr<GLImageNativePixmap> image = | 131 scoped_refptr<gl::GLImageNativePixmap> image = |
| 131 new GLImageNativePixmap(GetSize(), GL_BGRA_EXT); | 132 new gl::GLImageNativePixmap(GetSize(), GL_BGRA_EXT); |
| 132 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888)) | 133 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRA_8888)) |
| 133 return false; | 134 return false; |
| 134 images_[i] = image; | 135 images_[i] = image; |
| 135 // Bind image to texture. | 136 // Bind image to texture. |
| 136 gl::ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); | 137 gl::ScopedTextureBinder binder(GL_TEXTURE_2D, textures_[i]); |
| 137 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) | 138 if (!images_[i]->BindTexImage(GL_TEXTURE_2D)) |
| 138 return false; | 139 return false; |
| 139 } | 140 } |
| 140 return true; | 141 return true; |
| 141 } | 142 } |
| 142 | 143 |
| 143 } // namespace ui | 144 } // namespace ui |
| OLD | NEW |