Mir
miregl.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015-2018 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * under the terms of the GNU General Public License version 2 or 3 as
6  * 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 
17 #ifndef UNITYSYSTEMCOMPOSITOR_MIREGL_H
18 #define UNITYSYSTEMCOMPOSITOR_MIREGL_H
19 
20 #include "wayland_surface.h"
21 
22 #include <EGL/egl.h>
23 
24 #include <memory>
25 #include <vector>
26 
27 class MirEglApp;
28 class MirEglSurface;
29 
30 std::shared_ptr<MirEglApp> make_mir_eglapp(struct wl_display* display);
31 std::vector<std::shared_ptr<MirEglSurface>> mir_surface_init(std::shared_ptr<MirEglApp> const& app);
32 
34 {
35 public:
36  MirEglSurface(std::shared_ptr<MirEglApp> const& mir_egl_app, struct wl_output* wl_output);
37 
39 
40  template<typename Painter>
41  void paint(Painter const& functor)
42  {
43  egl_make_current();
44  functor(width_, height_);
45  swap_buffers();
46  }
47 
48 private:
49  void egl_make_current();
50 
51  void swap_buffers();
52 
53  std::shared_ptr<MirEglApp> const mir_egl_app;
54 
55  EGLSurface eglsurface;
56  int width_{0};
57  int height_{0};
58 
59 };
60 
61 #endif //UNITYSYSTEMCOMPOSITOR_MIREGL_H
Definition: miregl.h:34
void paint(Painter const &functor)
Definition: miregl.h:41
MirEglSurface(std::shared_ptr< MirEglApp > const &mir_egl_app, struct wl_output *wl_output)
Definition: miregl.cpp:73
~MirEglSurface()
Definition: miregl.cpp:90
Definition: wayland_surface.h:30
auto app() const -> WaylandApp const *
Definition: wayland_surface.h:41
std::vector< std::shared_ptr< MirEglSurface > > mir_surface_init(std::shared_ptr< MirEglApp > const &app)
Definition: miregl.cpp:61
std::shared_ptr< MirEglApp > make_mir_eglapp(struct wl_display *display)
Definition: miregl.cpp:56

Copyright © 2012-2022 Canonical Ltd.
Generated on Fri Feb 25 18:01:13 UTC 2022
This documentation is licensed under the GPL version 2 or 3.