Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / ui / ozone / demo / surfaceless_gl_renderer.h
blobb073c64530251eafe55b9e151fa4788ab02ef082
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
3 // found in the LICENSE file.
5 #ifndef UI_OZONE_DEMO_SURFACELESS_GL_RENDERER_H_
6 #define UI_OZONE_DEMO_SURFACELESS_GL_RENDERER_H_
8 #include "ui/ozone/demo/gl_renderer.h"
10 namespace gfx {
11 class GLImage;
12 } // namespace gfx
14 namespace ui {
16 class GpuMemoryBufferFactoryOzoneNativePixmap;
18 class SurfacelessGlRenderer : public GlRenderer {
19 public:
20 SurfacelessGlRenderer(
21 gfx::AcceleratedWidget widget,
22 const gfx::Size& size,
23 GpuMemoryBufferFactoryOzoneNativePixmap* buffer_factory);
24 ~SurfacelessGlRenderer() override;
26 // Renderer:
27 bool Initialize() override;
29 private:
30 // GlRenderer:
31 void RenderFrame() override;
32 scoped_refptr<gfx::GLSurface> CreateSurface() override;
34 class BufferWrapper {
35 public:
36 BufferWrapper();
37 ~BufferWrapper();
39 bool Initialize(GpuMemoryBufferFactoryOzoneNativePixmap* buffer_factory,
40 gfx::AcceleratedWidget widget,
41 const gfx::Size& size);
42 void BindFramebuffer();
43 void SchedulePlane();
45 private:
46 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
47 gfx::Size size_;
49 scoped_refptr<gfx::GLImage> image_;
50 unsigned int gl_fb_ = 0;
51 unsigned int gl_tex_ = 0;
54 GpuMemoryBufferFactoryOzoneNativePixmap* buffer_factory_;
56 BufferWrapper buffers_[2];
57 int back_buffer_ = 0;
59 base::WeakPtrFactory<SurfacelessGlRenderer> weak_ptr_factory_;
61 DISALLOW_COPY_AND_ASSIGN(SurfacelessGlRenderer);
64 } // namespace ui
66 #endif // UI_OZONE_DEMO_SURFACELESS_GL_RENDERER_H_