Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  bool can_bypass() const;
71  MirOrientation orientation() const override;
72 
74  RenderableList const& renderlist,
75  std::function<void(Renderable const&)> const& render_fn);
76 
77 private:
78  SurfacelessEGLContext const egl_context;
80  geometry::Rectangle const area;
81 };
82 
83 }
84 }
85 }
86 
87 #endif /* MIR_GRAPHICS_OFFSCREEN_DISPLAY_BUFFER_H_ */
Definition: size.h:30
Interface to an output framebuffer.
Definition: display_buffer.h:39
Definition: surfaceless_egl_context.h:32
MirOrientation
Definition: common.h:113
bool can_bypass() const
to be deprecated
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:88
Definition: renderable.h:33
Definition: display_buffer.h:59
void make_current()
Makes the DisplayBuffer the current GL rendering target.
void render_and_post_update(RenderableList const &renderlist, std::function< void(Renderable const &)> const &render_fn)
This will render renderlist to the screen and post the result to the screen.
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 Apr 11 21:14:53 UTC 2014