| 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 "ui/ozone/demo/surfaceless_gl_renderer.h" | 5 #include "ui/ozone/demo/surfaceless_gl_renderer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 } | 34 } |
| 35 } | 35 } |
| 36 | 36 |
| 37 bool SurfacelessGlRenderer::BufferWrapper::Initialize( | 37 bool SurfacelessGlRenderer::BufferWrapper::Initialize( |
| 38 gfx::AcceleratedWidget widget, | 38 gfx::AcceleratedWidget widget, |
| 39 const gfx::Size& size) { | 39 const gfx::Size& size) { |
| 40 glGenFramebuffersEXT(1, &gl_fb_); | 40 glGenFramebuffersEXT(1, &gl_fb_); |
| 41 glGenTextures(1, &gl_tex_); | 41 glGenTextures(1, &gl_tex_); |
| 42 | 42 |
| 43 gfx::BufferFormat format = display::DisplaySnapshot::PrimaryFormat(); | 43 gfx::BufferFormat format = display::DisplaySnapshot::PrimaryFormat(); |
| 44 scoped_refptr<NativePixmap> pixmap = | 44 scoped_refptr<gfx::NativePixmap> pixmap = |
| 45 OzonePlatform::GetInstance() | 45 OzonePlatform::GetInstance() |
| 46 ->GetSurfaceFactoryOzone() | 46 ->GetSurfaceFactoryOzone() |
| 47 ->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT); | 47 ->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT); |
| 48 scoped_refptr<ui::GLImageNativePixmap> image( | 48 scoped_refptr<gl::GLImageNativePixmap> image( |
| 49 new ui::GLImageNativePixmap(size, GL_RGB)); | 49 new gl::GLImageNativePixmap(size, GL_RGB)); |
| 50 if (!image->Initialize(pixmap.get(), format)) { | 50 if (!image->Initialize(pixmap.get(), format)) { |
| 51 LOG(ERROR) << "Failed to create GLImage"; | 51 LOG(ERROR) << "Failed to create GLImage"; |
| 52 return false; | 52 return false; |
| 53 } | 53 } |
| 54 image_ = image; | 54 image_ = image; |
| 55 | 55 |
| 56 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_); | 56 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_); |
| 57 glBindTexture(GL_TEXTURE_2D, gl_tex_); | 57 glBindTexture(GL_TEXTURE_2D, gl_tex_); |
| 58 image_->BindTexImage(GL_TEXTURE_2D); | 58 image_->BindTexImage(GL_TEXTURE_2D); |
| 59 | 59 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 case gfx::SwapResult::SWAP_ACK: | 156 case gfx::SwapResult::SWAP_ACK: |
| 157 GlRenderer::PostRenderFrameTask(result); | 157 GlRenderer::PostRenderFrameTask(result); |
| 158 break; | 158 break; |
| 159 case gfx::SwapResult::SWAP_FAILED: | 159 case gfx::SwapResult::SWAP_FAILED: |
| 160 LOG(FATAL) << "Failed to swap buffers"; | 160 LOG(FATAL) << "Failed to swap buffers"; |
| 161 break; | 161 break; |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace ui | 165 } // namespace ui |
| OLD | NEW |