Mir
display_buffer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2013 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3,
6  * as published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Alexandros Frantzis <alexandros.frantzis@canonical.com>
17  */
18 
19 #ifndef MIR_GRAPHICS_OFFSCREEN_DISPLAY_BUFFER_H_
20 #define MIR_GRAPHICS_OFFSCREEN_DISPLAY_BUFFER_H_
21 
23 
25 #include "mir/geometry/size.h"
26 #include "mir/geometry/rectangle.h"
27 
28 #include <EGL/egl.h>
29 
30 namespace mir
31 {
32 namespace graphics
33 {
34 namespace offscreen
35 {
36 
37 namespace detail
38 {
39 
41 {
42 public:
45  void bind() const;
46  void unbind() const;
47 
48 private:
49  geometry::Size const size;
50  int old_fbo;
51  int old_viewport[4];
52  unsigned int color_renderbuffer;
53  unsigned int depth_renderbuffer;
54  unsigned int fbo;
55 };
56 
57 }
58 
60 {
61 public:
63  geometry::Rectangle const& area);
64 
65  geometry::Rectangle view_area() const override;
66  void make_current() override;
67  void release_current() override;
68  void gl_swap_buffers() override;
69  void flip() override;
70 
71  MirOrientation orientation() const override;
72  bool uses_alpha() const override;
73 
74  bool post_renderables_if_optimizable(RenderableList const& renderlist) override;
75 
76 private:
77  SurfacelessEGLContext const egl_context;
79  geometry::Rectangle const area;
80 };
81 
82 }
83 }
84 }
85 
86 #endif /* MIR_GRAPHICS_OFFSCREEN_DISPLAY_BUFFER_H_ */
Definition: size.h:30
All things Mir.
Definition: buffer_stream.h:37
Interface to an output framebuffer.
Definition: display_buffer.h:38
void gl_swap_buffers() override
Swap buffers for OpenGL rendering.
bool uses_alpha() const override
Returns true if the display buffer has an alpha channel and the alpha channel will be read from at so...
void release_current() override
Releases the current GL rendering target.
Definition: surfaceless_egl_context.h:32
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:142
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:80
Definition: display_buffer.h:59
geometry::Rectangle view_area() const override
The area the DisplayBuffer occupies in the virtual screen space.
bool post_renderables_if_optimizable(RenderableList const &renderlist) override
This will render renderlist to the screen and post the result to the screen if there is a hardware op...
void flip() override
After gl_swap_buffers, flip the new front buffer to the screen This most likely involves a wait for v...
Definition: rectangle.h:33
void make_current() override
Makes the DisplayBuffer the current GL rendering target.
MirOrientation orientation() const override
Returns the orientation of the display buffer relative to how the user should see it (the orientation...

Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Mar 24 16:15:19 UTC 2015