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"
16 class SurfacelessGlRenderer
: public GlRenderer
{
18 SurfacelessGlRenderer(gfx::AcceleratedWidget widget
,
19 const scoped_refptr
<gfx::GLSurface
>& surface
,
20 const gfx::Size
& size
);
21 ~SurfacelessGlRenderer() override
;
24 bool Initialize() override
;
28 void RenderFrame() override
;
29 void PostRenderFrameTask(gfx::SwapResult result
) override
;
36 gfx::GLImage
* image() const { return image_
.get(); }
38 bool Initialize(gfx::AcceleratedWidget widget
, const gfx::Size
& size
);
39 void BindFramebuffer();
42 gfx::AcceleratedWidget widget_
= gfx::kNullAcceleratedWidget
;
45 scoped_refptr
<gfx::GLImage
> image_
;
46 unsigned int gl_fb_
= 0;
47 unsigned int gl_tex_
= 0;
50 scoped_ptr
<BufferWrapper
> buffers_
[2];
53 base::WeakPtrFactory
<SurfacelessGlRenderer
> weak_ptr_factory_
;
55 DISALLOW_COPY_AND_ASSIGN(SurfacelessGlRenderer
);
60 #endif // UI_OZONE_DEMO_SURFACELESS_GL_RENDERER_H_