Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: ui/ozone/demo/surfaceless_gl_renderer.cc

Issue 1263913002: FREEZE.unindexed Base URL: https://chromium.googlesource.com/chromium/src.git@textures3
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "content/common/generic_shared_memory_id_generator.h"
8 #include "ui/gl/gl_bindings.h" 9 #include "ui/gl/gl_bindings.h"
9 #include "ui/gl/gl_context.h" 10 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_image.h" 11 #include "ui/gl/gl_image.h"
11 #include "ui/gl/gl_image_ozone_native_pixmap.h" 12 #include "ui/gl/gl_image_ozone_native_pixmap.h"
12 #include "ui/gl/gl_surface.h" 13 #include "ui/gl/gl_surface.h"
13 #include "ui/ozone/public/ozone_platform.h" 14 #include "ui/ozone/public/ozone_platform.h"
14 #include "ui/ozone/public/surface_factory_ozone.h" 15 #include "ui/ozone/public/surface_factory_ozone.h"
15 16
16 namespace ui { 17 namespace ui {
17 18
(...skipping 17 matching lines...) Expand all
35 glGenFramebuffersEXT(1, &gl_fb_); 36 glGenFramebuffersEXT(1, &gl_fb_);
36 glGenTextures(1, &gl_tex_); 37 glGenTextures(1, &gl_tex_);
37 38
38 scoped_refptr<NativePixmap> pixmap = 39 scoped_refptr<NativePixmap> pixmap =
39 OzonePlatform::GetInstance() 40 OzonePlatform::GetInstance()
40 ->GetSurfaceFactoryOzone() 41 ->GetSurfaceFactoryOzone()
41 ->CreateNativePixmap(widget, size, gfx::BufferFormat::RGBX_8888, 42 ->CreateNativePixmap(widget, size, gfx::BufferFormat::RGBX_8888,
42 gfx::BufferUsage::SCANOUT); 43 gfx::BufferUsage::SCANOUT);
43 scoped_refptr<gfx::GLImageOzoneNativePixmap> image( 44 scoped_refptr<gfx::GLImageOzoneNativePixmap> image(
44 new gfx::GLImageOzoneNativePixmap(size, GL_RGB)); 45 new gfx::GLImageOzoneNativePixmap(size, GL_RGB));
45 if (!image->Initialize(pixmap.get(), gfx::BufferFormat::RGBX_8888)) { 46 if (!image->Initialize(GetNextGenericSharedMemoryId(), pixmap.get(),
47 gfx::GpuMemoryBuffer::RGBX_8888)) {
46 LOG(ERROR) << "Failed to create GLImage"; 48 LOG(ERROR) << "Failed to create GLImage";
47 return false; 49 return false;
48 } 50 }
49 image_ = image; 51 image_ = image;
50 52
51 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_); 53 glBindFramebufferEXT(GL_FRAMEBUFFER, gl_fb_);
52 glBindTexture(GL_TEXTURE_2D, gl_tex_); 54 glBindTexture(GL_TEXTURE_2D, gl_tex_);
53 image_->BindTexImage(GL_TEXTURE_2D); 55 image_->BindTexImage(GL_TEXTURE_2D);
54 56
55 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 57 glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 if (!surface_->SwapBuffersAsync(base::Bind(&GlRenderer::PostRenderFrameTask, 114 if (!surface_->SwapBuffersAsync(base::Bind(&GlRenderer::PostRenderFrameTask,
113 weak_ptr_factory_.GetWeakPtr()))) 115 weak_ptr_factory_.GetWeakPtr())))
114 LOG(FATAL) << "Failed to swap buffers"; 116 LOG(FATAL) << "Failed to swap buffers";
115 } 117 }
116 118
117 scoped_refptr<gfx::GLSurface> SurfacelessGlRenderer::CreateSurface() { 119 scoped_refptr<gfx::GLSurface> SurfacelessGlRenderer::CreateSurface() {
118 return gfx::GLSurface::CreateSurfacelessViewGLSurface(widget_); 120 return gfx::GLSurface::CreateSurfacelessViewGLSurface(widget_);
119 } 121 }
120 122
121 } // namespace ui 123 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_ozone.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698