Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
screencast_display_buffer.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2014 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_COMPOSITOR_SCREENCAST_DISPLAY_BUFFER_H_
20 #define MIR_COMPOSITOR_SCREENCAST_DISPLAY_BUFFER_H_
21 
23 
24 #include <GLES2/gl2.h>
25 
26 namespace mir
27 {
28 namespace compositor
29 {
30 namespace detail
31 {
32 
33 template <void (*Generate)(GLsizei,GLuint*), void (*Delete)(GLsizei,GLuint const*)>
35 {
36 public:
37  GLResource() { Generate(1, &resource); }
38  ~GLResource() { Delete(1, &resource); }
39  operator GLuint() const { return resource; }
40 
41 private:
42  GLResource(GLResource const&) = delete;
43  GLResource& operator=(GLResource const&) = delete;
44  GLuint resource = 0;
45 };
46 }
47 
49 {
50 public:
52  geometry::Rectangle const& rect,
53  graphics::Buffer& buffer);
55 
57 
58  void make_current();
59 
60  void release_current();
61 
64  std::function<void(graphics::Renderable const&)> const&);
65 
66  void post_update();
67 
68  bool can_bypass() const;
69 
71 
72 private:
73  geometry::Rectangle const rect;
74  graphics::Buffer& buffer;
75  GLint old_fbo;
76  GLint old_viewport[4];
80 };
81 
82 }
83 }
84 
85 #endif /* MIR_COMPOSITOR_SCREENCAST_DISPLAY_BUFFER_H_ */
GLResource()
Definition: screencast_display_buffer.h:37
Definition: screencast_display_buffer.h:48
Interface to an output framebuffer.
Definition: display_buffer.h:39
Definition: screencast_display_buffer.h:34
~GLResource()
Definition: screencast_display_buffer.h:38
MirOrientation
Definition: common.h:113
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:88
MirOrientation orientation() const
Returns the orientation of the display buffer relative to how the user should see it (the orientation...
Definition: screencast_display_buffer.cpp:108
Definition: renderable.h:33
~ScreencastDisplayBuffer()
Definition: screencast_display_buffer.cpp:58
void make_current()
Makes the DisplayBuffer the current GL rendering target.
Definition: screencast_display_buffer.cpp:68
geometry::Rectangle view_area() const
The area the DisplayBuffer occupies in the virtual screen space.
Definition: screencast_display_buffer.cpp:63
Definition: rectangle.h:33
bool can_bypass() const
to be deprecated
Definition: screencast_display_buffer.cpp:103
Definition: buffer.h:34
void post_update()
This will trigger OpenGL rendering and post the result to the screen.
Definition: screencast_display_buffer.cpp:98
void render_and_post_update(graphics::RenderableList const &, std::function< void(graphics::Renderable const &)> const &)
Definition: screencast_display_buffer.cpp:88
void release_current()
Releases the current GL rendering target.
Definition: screencast_display_buffer.cpp:81
ScreencastDisplayBuffer(geometry::Rectangle const &rect, graphics::Buffer &buffer)
Definition: screencast_display_buffer.cpp:28

Copyright © 2012,2013 Canonical Ltd.
Generated on Fri Apr 11 21:14:53 UTC 2014