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" |
11 #include "base/trace_event/trace_event.h" | 11 #include "base/trace_event/trace_event.h" |
12 #include "ui/gl/gl_bindings.h" | 12 #include "ui/gl/gl_bindings.h" |
13 #include "ui/gl/gl_context.h" | 13 #include "ui/gl/gl_context.h" |
14 #include "ui/gl/gl_image.h" | 14 #include "ui/gl/gl_image.h" |
15 #include "ui/gl/gl_image_ozone_native_pixmap.h" | |
16 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
| 16 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h" |
17 #include "ui/ozone/public/ozone_platform.h" | 17 #include "ui/ozone/public/ozone_platform.h" |
18 #include "ui/ozone/public/surface_factory_ozone.h" | 18 #include "ui/ozone/public/surface_factory_ozone.h" |
19 | 19 |
20 namespace ui { | 20 namespace ui { |
21 | 21 |
22 SurfacelessGlRenderer::BufferWrapper::BufferWrapper() { | 22 SurfacelessGlRenderer::BufferWrapper::BufferWrapper() { |
23 } | 23 } |
24 | 24 |
25 SurfacelessGlRenderer::BufferWrapper::~BufferWrapper() { | 25 SurfacelessGlRenderer::BufferWrapper::~BufferWrapper() { |
26 if (gl_fb_) | 26 if (gl_fb_) |
(...skipping 10 matching lines...) Expand all Loading... |
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 scoped_refptr<NativePixmap> pixmap = | 42 scoped_refptr<NativePixmap> pixmap = |
43 OzonePlatform::GetInstance() | 43 OzonePlatform::GetInstance() |
44 ->GetSurfaceFactoryOzone() | 44 ->GetSurfaceFactoryOzone() |
45 ->CreateNativePixmap(widget, size, gfx::BufferFormat::BGRX_8888, | 45 ->CreateNativePixmap(widget, size, gfx::BufferFormat::BGRX_8888, |
46 gfx::BufferUsage::SCANOUT); | 46 gfx::BufferUsage::SCANOUT); |
47 scoped_refptr<gl::GLImageOzoneNativePixmap> image( | 47 scoped_refptr<ui::GLImageOzoneNativePixmap> image( |
48 new gl::GLImageOzoneNativePixmap(size, GL_RGB)); | 48 new ui::GLImageOzoneNativePixmap(size, GL_RGB)); |
49 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRX_8888)) { | 49 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::BGRX_8888)) { |
50 LOG(ERROR) << "Failed to create GLImage"; | 50 LOG(ERROR) << "Failed to create GLImage"; |
51 return false; | 51 return false; |
52 } | 52 } |
53 image_ = image; | 53 image_ = image; |
54 | 54 |
55 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_); | 55 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_); |
56 glBindTexture(GL_TEXTURE_2D, gl_tex_); | 56 glBindTexture(GL_TEXTURE_2D, gl_tex_); |
57 image_->BindTexImage(GL_TEXTURE_2D); | 57 image_->BindTexImage(GL_TEXTURE_2D); |
58 | 58 |
(...skipping 74 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 |