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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "ui/gl/gl_bindings.h" | 8 #include "ui/gl/gl_bindings.h" |
9 #include "ui/gl/gl_context.h" | 9 #include "ui/gl/gl_context.h" |
10 #include "ui/gl/gl_image.h" | 10 #include "ui/gl/gl_image.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 | 31 |
32 bool SurfacelessGlRenderer::BufferWrapper::Initialize( | 32 bool SurfacelessGlRenderer::BufferWrapper::Initialize( |
33 gfx::AcceleratedWidget widget, | 33 gfx::AcceleratedWidget widget, |
34 const gfx::Size& size) { | 34 const gfx::Size& size) { |
35 glGenFramebuffersEXT(1, &gl_fb_); | 35 glGenFramebuffersEXT(1, &gl_fb_); |
36 glGenTextures(1, &gl_tex_); | 36 glGenTextures(1, &gl_tex_); |
37 | 37 |
38 scoped_refptr<NativePixmap> pixmap = | 38 scoped_refptr<NativePixmap> pixmap = |
39 OzonePlatform::GetInstance() | 39 OzonePlatform::GetInstance() |
40 ->GetSurfaceFactoryOzone() | 40 ->GetSurfaceFactoryOzone() |
41 ->CreateNativePixmap(widget, size, SurfaceFactoryOzone::RGBX_8888, | 41 ->CreateNativePixmap(widget, size, gfx::BufferFormat::RGBX_8888, |
42 SurfaceFactoryOzone::SCANOUT); | 42 gfx::BufferUsage::SCANOUT); |
43 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( | 43 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( |
44 new gfx::GLImageOzoneNativePixmap(size, GL_RGB)); | 44 new gfx::GLImageOzoneNativePixmap(size, GL_RGB)); |
45 if (!image->Initialize(pixmap.get(), gfx::GpuMemoryBuffer::RGBX_8888)) { | 45 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::RGBX_8888)) { |
46 LOG(ERROR) << "Failed to create GLImage"; | 46 LOG(ERROR) << "Failed to create GLImage"; |
47 return false; | 47 return false; |
48 } | 48 } |
49 image_ = image; | 49 image_ = image; |
50 | 50 |
51 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_); | 51 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_); |
52 glBindTexture(GL_TEXTURE_2D, gl_tex_); | 52 glBindTexture(GL_TEXTURE_2D, gl_tex_); |
53 image_->BindTexImage(GL_TEXTURE_2D); | 53 image_->BindTexImage(GL_TEXTURE_2D); |
54 | 54 |
55 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, | 55 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 if (!surface_->SwapBuffersAsync(base::Bind(&GlRenderer::PostRenderFrameTask, | 112 if (!surface_->SwapBuffersAsync(base::Bind(&GlRenderer::PostRenderFrameTask, |
113 weak_ptr_factory_.GetWeakPtr()))) | 113 weak_ptr_factory_.GetWeakPtr()))) |
114 LOG(FATAL) << "Failed to swap buffers"; | 114 LOG(FATAL) << "Failed to swap buffers"; |
115 } | 115 } |
116 | 116 |
117 scoped_refptr<gfx::GLSurface> SurfacelessGlRenderer::CreateSurface() { | 117 scoped_refptr<gfx::GLSurface> SurfacelessGlRenderer::CreateSurface() { |
118 return gfx::GLSurface::CreateSurfacelessViewGLSurface(widget_); | 118 return gfx::GLSurface::CreateSurfacelessViewGLSurface(widget_); |
119 } | 119 } |
120 | 120 |
121 } // namespace ui | 121 } // namespace ui |
OLD | NEW |