Mir
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 
56  geometry::Rectangle view_area() const override;
57 
58  void make_current() override;
59 
60  void release_current() override;
61 
63 
64  void gl_swap_buffers() override;
65  void flip() override;
66 
67  MirOrientation orientation() const override;
68 
69  bool uses_alpha() const override;
70 
71 private:
72  geometry::Rectangle const rect;
73  graphics::Buffer& buffer;
74  GLint old_fbo;
75  GLint old_viewport[4];
79 };
80 
81 }
82 }
83 
84 #endif /* MIR_COMPOSITOR_SCREENCAST_DISPLAY_BUFFER_H_ */
All things Mir.
Definition: buffer_stream.h:37
bool post_renderables_if_optimizable(graphics::RenderableList const &) override
This will render renderlist to the screen and post the result to the screen if there is a hardware op...
Definition: screencast_display_buffer.cpp:88
MirOrientation orientation() const override
Returns the orientation of the display buffer relative to how the user should see it (the orientation...
Definition: screencast_display_buffer.cpp:102
GLResource()
Definition: screencast_display_buffer.h:37
Definition: screencast_display_buffer.h:48
Interface to an output framebuffer.
Definition: display_buffer.h:38
Definition: screencast_display_buffer.h:34
void flip() override
After gl_swap_buffers, flip the new front buffer to the screen This most likely involves a wait for v...
Definition: screencast_display_buffer.cpp:98
~GLResource()
Definition: screencast_display_buffer.h:38
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:142
geometry::Rectangle view_area() const override
The area the DisplayBuffer occupies in the virtual screen space.
Definition: screencast_display_buffer.cpp:63
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:80
void make_current() override
Makes the DisplayBuffer the current GL rendering target.
Definition: screencast_display_buffer.cpp:68
~ScreencastDisplayBuffer()
Definition: screencast_display_buffer.cpp:58
void release_current() override
Releases the current GL rendering target.
Definition: screencast_display_buffer.cpp:81
Definition: rectangle.h:33
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: screencast_display_buffer.cpp:107
Definition: buffer.h:34
void gl_swap_buffers() override
Swap buffers for OpenGL rendering.
Definition: screencast_display_buffer.cpp:93
ScreencastDisplayBuffer(geometry::Rectangle const &rect, graphics::Buffer &buffer)
Definition: screencast_display_buffer.cpp:28

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