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 
24 
25 #include <GLES2/gl2.h>
26 
27 namespace mir
28 {
29 namespace renderer { namespace gl { class TextureSource; }}
30 namespace compositor
31 {
32 namespace detail
33 {
34 
35 template <void (*Generate)(GLsizei,GLuint*), void (*Delete)(GLsizei,GLuint const*)>
37 {
38 public:
39  GLResource() { Generate(1, &resource); }
40  ~GLResource() { Delete(1, &resource); }
41  operator GLuint() const { return resource; }
42 
43 private:
44  GLResource(GLResource const&) = delete;
45  GLResource& operator=(GLResource const&) = delete;
46  GLuint resource = 0;
47 };
48 }
49 
53 {
54 public:
56  geometry::Rectangle const& rect,
57  graphics::Buffer& buffer);
59 
60  geometry::Rectangle view_area() const override;
61 
62  void make_current() override;
63 
64  void release_current() override;
65 
67 
68  void swap_buffers() override;
69 
70  MirOrientation orientation() const override;
71 
73 
74 private:
75  geometry::Rectangle const rect;
76  graphics::Buffer& buffer;
77  renderer::gl::TextureSource* texture_source;
78  GLint old_fbo;
79  GLint old_viewport[4];
83 };
84 
85 }
86 }
87 
88 #endif /* MIR_COMPOSITOR_SCREENCAST_DISPLAY_BUFFER_H_ */
All things Mir.
Definition: atomic_callback.h:25
Definition: texture_source.h:29
NativeDisplayBuffer * native_display_buffer() override
Returns a pointer to the native display buffer object backing this display buffer.
Definition: screencast_display_buffer.cpp:110
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:95
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:105
GLResource()
Definition: screencast_display_buffer.h:39
Definition: screencast_display_buffer.h:50
Interface to an output framebuffer.
Definition: display_buffer.h:47
Definition: screencast_display_buffer.h:36
void swap_buffers() override
Swap buffers for OpenGL rendering.
Definition: screencast_display_buffer.cpp:100
~GLResource()
Definition: screencast_display_buffer.h:40
MirOrientation
Direction relative to the "natural" orientation of the display.
Definition: common.h:164
geometry::Rectangle view_area() const override
The area the DisplayBuffer occupies in the virtual screen space.
Definition: screencast_display_buffer.cpp:70
void make_current() override
Makes the the current GL render target.
Definition: screencast_display_buffer.cpp:75
~ScreencastDisplayBuffer()
Definition: screencast_display_buffer.cpp:65
Definition: display_buffer.h:35
Definition: render_target.h:29
void release_current() override
Releases the current GL render target.
Definition: screencast_display_buffer.cpp:88
std::vector< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:79
Definition: rectangle.h:33
Definition: buffer.h:44
ScreencastDisplayBuffer(geometry::Rectangle const &rect, graphics::Buffer &buffer)
Definition: screencast_display_buffer.cpp:29

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