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 "base/memory/weak_ptr.h"
9 #include "ui/ozone/demo/gl_renderer.h"
17 class GpuMemoryBufferFactoryOzoneNativeBuffer
;
19 class SurfacelessGlRenderer
: public GlRenderer
{
21 SurfacelessGlRenderer(
22 gfx::AcceleratedWidget widget
,
23 const gfx::Size
& size
,
24 GpuMemoryBufferFactoryOzoneNativeBuffer
* buffer_factory
);
25 ~SurfacelessGlRenderer() override
;
28 bool Initialize() override
;
29 void RenderFrame() override
;
32 // Called by swap buffers when the actual swap finished.
33 void OnSwapBuffersAck();
40 bool Initialize(GpuMemoryBufferFactoryOzoneNativeBuffer
* buffer_factory
,
41 gfx::AcceleratedWidget widget
,
42 const gfx::Size
& size
);
43 void BindFramebuffer();
47 gfx::AcceleratedWidget widget_
;
50 scoped_refptr
<gfx::GLImage
> image_
;
55 GpuMemoryBufferFactoryOzoneNativeBuffer
* buffer_factory_
;
57 BufferWrapper buffers_
[2];
59 bool is_swapping_buffers_
;
61 base::WeakPtrFactory
<SurfacelessGlRenderer
> weak_ptr_factory_
;
63 DISALLOW_COPY_AND_ASSIGN(SurfacelessGlRenderer
);
68 #endif // UI_OZONE_DEMO_SURFACELESS_GL_RENDERER_H_