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"
28 
29 #include <EGL/egl.h>
30 
31 namespace mir
32 {
33 namespace graphics
34 {
35 namespace offscreen
36 {
37 
38 namespace detail
39 {
40 
42 {
43 public:
46  void bind() const;
47  void unbind() const;
48 
49 private:
50  geometry::Size const size;
51  int old_fbo;
52  int old_viewport[4];
53  unsigned int color_renderbuffer;
54  unsigned int depth_renderbuffer;
55  unsigned int fbo;
56 };
57 
58 }
59 
63 {
64 public:
66  geometry::Rectangle const& area);
67 
68  geometry::Rectangle view_area() const override;
69  void make_current() override;
70  void release_current() override;
71  void swap_buffers() override;
72 
73  MirOrientation orientation() const override;
74 
75  bool post_renderables_if_optimizable(RenderableList const& renderlist) override;
76 
78 
79 private:
80  SurfacelessEGLContext const egl_context;
82  geometry::Rectangle const area;
83 };
84 
85 }
86 }
87 }
88 
89 #endif /* MIR_GRAPHICS_OFFSCREEN_DISPLAY_BUFFER_H_ */
Definition: size.h:30
All things Mir.
Definition: atomic_callback.h:25
Interface to an output framebuffer.
Definition: display_buffer.h:47
void release_current() override
Releases the current GL render target.
NativeDisplayBuffer * native_display_buffer() override
Returns a pointer to the native display buffer object backing this display buffer.
Definition: surfaceless_egl_context.h:32
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:164
Definition: display_buffer.h:35
void swap_buffers() override
Swap buffers for OpenGL rendering.
Definition: display_buffer.h:60
geometry::Rectangle view_area() const override
The area the DisplayBuffer occupies in the virtual screen space.
Definition: render_target.h:29
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...
std::vector< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:79
Definition: rectangle.h:33
void make_current() override
Makes the the current GL render target.
MirOrientation orientation() const override
Returns the orientation of the display buffer relative to how the user should see it (the orientation...

Copyright © 2012-2015 Canonical Ltd.
Generated on Thu Oct 8 16:20:16 UTC 2015