| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 glDeleteTextures(1, &gl_tex_); | 32 glDeleteTextures(1, &gl_tex_); |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 bool SurfacelessGlRenderer::BufferWrapper::Initialize( | 36 bool SurfacelessGlRenderer::BufferWrapper::Initialize( |
| 37 gfx::AcceleratedWidget widget, | 37 gfx::AcceleratedWidget widget, |
| 38 const gfx::Size& size) { | 38 const gfx::Size& size) { |
| 39 glGenFramebuffersEXT(1, &gl_fb_); | 39 glGenFramebuffersEXT(1, &gl_fb_); |
| 40 glGenTextures(1, &gl_tex_); | 40 glGenTextures(1, &gl_tex_); |
| 41 | 41 |
| 42 gfx::BufferFormat format = ui::DisplaySnapshot::PrimaryFormat(); | 42 gfx::BufferFormat format = display::DisplaySnapshot::PrimaryFormat(); |
| 43 scoped_refptr<NativePixmap> pixmap = | 43 scoped_refptr<NativePixmap> pixmap = |
| 44 OzonePlatform::GetInstance() | 44 OzonePlatform::GetInstance() |
| 45 ->GetSurfaceFactoryOzone() | 45 ->GetSurfaceFactoryOzone() |
| 46 ->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT); | 46 ->CreateNativePixmap(widget, size, format, gfx::BufferUsage::SCANOUT); |
| 47 scoped_refptr<ui::GLImageOzoneNativePixmap> image( | 47 scoped_refptr<ui::GLImageOzoneNativePixmap> image( |
| 48 new ui::GLImageOzoneNativePixmap(size, GL_RGB)); | 48 new ui::GLImageOzoneNativePixmap(size, GL_RGB)); |
| 49 if (!image->Initialize(pixmap.get(), format)) { | 49 if (!image->Initialize(pixmap.get(), format)) { |
| 50 LOG(ERROR) << "Failed to create GLImage"; | 50 LOG(ERROR) << "Failed to create GLImage"; |
| 51 return false; | 51 return false; |
| 52 } | 52 } |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 case gfx::SwapResult::SWAP_ACK: | 133 case gfx::SwapResult::SWAP_ACK: |
| 134 GlRenderer::PostRenderFrameTask(result); | 134 GlRenderer::PostRenderFrameTask(result); |
| 135 break; | 135 break; |
| 136 case gfx::SwapResult::SWAP_FAILED: | 136 case gfx::SwapResult::SWAP_FAILED: |
| 137 LOG(FATAL) << "Failed to swap buffers"; | 137 LOG(FATAL) << "Failed to swap buffers"; |
| 138 break; | 138 break; |
| 139 } | 139 } |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace ui | 142 } // namespace ui |
| OLD | NEW |