ozone: evdev: Sync caps lock LED state to evdev
[chromium-blink-merge.git] / ui / ozone / demo / surfaceless_gl_renderer.h
blob9356ab1b588741b7f4c5abc9865f1b49a0f32676
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"
11 namespace gfx {
12 class GLImage;
13 } // namespace gfx
15 namespace ui {
17 class GpuMemoryBufferFactoryOzoneNativeBuffer;
19 class SurfacelessGlRenderer : public GlRenderer {
20 public:
21 SurfacelessGlRenderer(
22 gfx::AcceleratedWidget widget,
23 const gfx::Size& size,
24 GpuMemoryBufferFactoryOzoneNativeBuffer* buffer_factory);
25 ~SurfacelessGlRenderer() override;
27 // Renderer:
28 bool Initialize() override;
29 void RenderFrame() override;
31 private:
32 // Called by swap buffers when the actual swap finished.
33 void OnSwapBuffersAck();
35 class BufferWrapper {
36 public:
37 BufferWrapper();
38 ~BufferWrapper();
40 bool Initialize(GpuMemoryBufferFactoryOzoneNativeBuffer* buffer_factory,
41 gfx::AcceleratedWidget widget,
42 const gfx::Size& size);
43 void BindFramebuffer();
44 void SchedulePlane();
46 private:
47 gfx::AcceleratedWidget widget_;
48 gfx::Size size_;
50 scoped_refptr<gfx::GLImage> image_;
51 unsigned int gl_fb_;
52 unsigned int gl_tex_;
55 GpuMemoryBufferFactoryOzoneNativeBuffer* buffer_factory_;
57 BufferWrapper buffers_[2];
58 int back_buffer_;
59 bool is_swapping_buffers_;
61 base::WeakPtrFactory<SurfacelessGlRenderer> weak_ptr_factory_;
63 DISALLOW_COPY_AND_ASSIGN(SurfacelessGlRenderer);
66 } // namespace ui
68 #endif // UI_OZONE_DEMO_SURFACELESS_GL_RENDERER_H_