Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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 
66  void make_current();
67  void release_current();
68  void post_update();
69 
70  MirOrientation orientation() const override;
71  bool uses_alpha() const override;
72 
73  bool post_renderables_if_optimizable(RenderableList const& renderlist) override;
74 
75 private:
76  SurfacelessEGLContext const egl_context;
78  geometry::Rectangle const area;
79 };
80 
81 }
82 }
83 }
84 
85 #endif /* MIR_GRAPHICS_OFFSCREEN_DISPLAY_BUFFER_H_ */
Definition: size.h:30
All things Mir.
Definition: aging_buffer.h:24
Interface to an output framebuffer.
Definition: display_buffer.h:38
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...
Definition: surfaceless_egl_context.h:32
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:134
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:88
Definition: display_buffer.h:59
void make_current()
Makes the DisplayBuffer the current GL rendering target.
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...
geometry::Rectangle view_area() const
The area the DisplayBuffer occupies in the virtual screen space.
Definition: rectangle.h:33
void post_update()
This will trigger OpenGL rendering and post the result to the screen.
void release_current()
Releases 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 Fri Oct 10 14:07:14 UTC 2014