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();
36 scoped_refptr
<gfx::GLSurface
> CreateSurface() override
;
43 bool Initialize(GpuMemoryBufferFactoryOzoneNativeBuffer
* buffer_factory
,
44 gfx::AcceleratedWidget widget
,
45 const gfx::Size
& size
);
46 void BindFramebuffer();
50 gfx::AcceleratedWidget widget_
;
53 scoped_refptr
<gfx::GLImage
> image_
;
58 GpuMemoryBufferFactoryOzoneNativeBuffer
* buffer_factory_
;
60 BufferWrapper buffers_
[2];
62 bool is_swapping_buffers_
;
64 base::WeakPtrFactory
<SurfacelessGlRenderer
> weak_ptr_factory_
;
66 DISALLOW_COPY_AND_ASSIGN(SurfacelessGlRenderer
);
71 #endif // UI_OZONE_DEMO_SURFACELESS_GL_RENDERER_H_