Mir
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
nested_output.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: Alan Griffiths <alan@octopull.co.uk>
17  */
18 
19 #ifndef MIR_GRAPHICS_NESTED_DETAIL_NESTED_OUTPUT_H_
20 #define MIR_GRAPHICS_NESTED_DETAIL_NESTED_OUTPUT_H_
21 
22 #include "nested_display.h"
23 
24 namespace mir
25 {
26 namespace graphics
27 {
28 namespace nested
29 {
30 namespace detail
31 {
32 
33 class EGLSurfaceHandle;
35 {
36 public:
37  explicit MirSurfaceHandle(MirSurface* mir_surface);
38 
39  ~MirSurfaceHandle() noexcept;
40 
41  operator MirSurface*() const { return mir_surface; }
42 
43 private:
44  MirSurface* mir_surface;
45 
46  MirSurfaceHandle(MirSurfaceHandle const&) = delete;
47  MirSurfaceHandle operator=(MirSurfaceHandle const&) = delete;
48 };
49 
51 {
52 public:
54  EGLDisplayHandle const& egl_display,
55  MirSurface* mir_surface,
56  geometry::Rectangle const& area,
57  std::shared_ptr<input::EventFilter> const& event_handler,
58  MirPixelFormat preferred_format);
59 
60  ~NestedOutput() noexcept;
61 
62  geometry::Rectangle view_area() const override;
63  void make_current() override;
64  void release_current() override;
65  void post_update() override;
66  virtual bool can_bypass() const override;
67  MirOrientation orientation() const override;
68 
70  RenderableList const& renderlist,
71  std::function<void(Renderable const&)> const& render_fn);
72 
73  NestedOutput(NestedOutput const&) = delete;
74  NestedOutput operator=(NestedOutput const&) = delete;
75 private:
76  EGLDisplayHandle const& egl_display;
77  MirSurfaceHandle const mir_surface;
78  EGLConfig const egl_config;
79  EGLContextStore const egl_context;
80  geometry::Rectangle const area;
81  std::shared_ptr<input::EventFilter> const event_handler;
82  EGLSurfaceHandle const egl_surface;
83 
84  static void event_thunk(MirSurface* surface, MirEvent const* event, void* context);
85  void mir_event(MirEvent const& event);
86 };
87 }
88 }
89 }
90 }
91 
92 #endif /* MIR_GRAPHICS_NESTED_DETAIL_NESTED_OUTPUT_H_ */
Definition: mir_surface.h:54
Interface to an output framebuffer.
Definition: display_buffer.h:39
~NestedOutput() noexcept
Definition: nested_output.cpp:100
NestedOutput(EGLDisplayHandle const &egl_display, MirSurface *mir_surface, geometry::Rectangle const &area, std::shared_ptr< input::EventFilter > const &event_handler, MirPixelFormat preferred_format)
Definition: nested_output.cpp:40
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.
Definition: nested_output.cpp:85
MirOrientation
Definition: common.h:113
MirOrientation orientation() const override
Returns the orientation of the display buffer relative to how the user should see it (the orientation...
Definition: nested_output.cpp:91
void make_current() override
Makes the DisplayBuffer the current GL rendering target.
Definition: nested_output.cpp:63
std::list< std::shared_ptr< Renderable > > RenderableList
Definition: renderable.h:88
~MirSurfaceHandle() noexcept
Definition: nested_output.cpp:35
Definition: renderable.h:33
void release_current() override
Releases the current GL rendering target.
Definition: nested_output.cpp:69
virtual bool can_bypass() const override
to be deprecated
Definition: nested_output.cpp:79
Definition: egl_resources.h:29
MirPixelFormat
The order of components in a format enum matches the order of the components as they would be written...
Definition: common.h:99
void post_update() override
This will trigger OpenGL rendering and post the result to the screen.
Definition: nested_output.cpp:74
geometry::Rectangle view_area() const override
The area the DisplayBuffer occupies in the virtual screen space.
Definition: nested_output.cpp:58
Definition: rectangle.h:33
Definition: event.h:207
NestedOutput operator=(NestedOutput const &)=delete
MirSurfaceHandle(MirSurface *mir_surface)
Definition: nested_output.cpp:30
Definition: nested_output.h:50

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