Mir
miregl.h
Go to the documentation of this file.
1 /*
2  * Copyright © 2015 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 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 <mir/client/surface.h>
21 #include <mir/client/window.h>
22 
23 #include <EGL/egl.h>
24 
25 #include <memory>
26 
27 class MirEglApp;
28 class MirEglSurface;
29 
30 std::shared_ptr<MirEglApp> make_mir_eglapp(
31  MirConnection* const connection,
33 
35 {
36 public:
38  std::shared_ptr<MirEglApp> const& mir_egl_app,
39  char const* name,
40  MirOutput const* output);
41 
43 
44  template<typename Painter>
45  void paint(Painter const& functor)
46  {
47  egl_make_current();
48  functor(width(), height());
49  swap_buffers();
50  }
51 
52 private:
53  void egl_make_current();
54 
55  void swap_buffers();
56  unsigned int width() const;
57  unsigned int height() const;
58 
59  std::shared_ptr<MirEglApp> const mir_egl_app;
60  mir::client::Surface surface;
61  mir::client::Window window;
62  EGLSurface eglsurface;
63  int width_;
64  int height_;
65 };
66 
67 #endif //UNITYSYSTEMCOMPOSITOR_MIREGL_H
struct MirOutput MirOutput
Descriptor for an output connection.
Definition: client_types.h:72
MirEglSurface(std::shared_ptr< MirEglApp > const &mir_egl_app, char const *name, MirOutput const *output)
Definition: miregl.cpp:64
Definition: miregl.h:34
MirPixelFormat pixel_format
Definition: client_types.h:180
Handle class for MirWindow - provides automatic reference counting.
Definition: window.h:31
std::shared_ptr< MirEglApp > make_mir_eglapp(MirConnection *const connection, MirPixelFormat const &pixel_format)
Definition: miregl.cpp:58
struct MirConnection MirConnection
Definition: client_types.h:41
MirPixelFormat
32-bit pixel formats (8888): The order of components in the enum matches the order of the components ...
Definition: common.h:241
char const * name
Definition: client_types.h:177
Handle class for MirRenderSurface - provides automatic reference counting.
Definition: surface.h:31
~MirEglSurface()
Definition: miregl.cpp:92
void paint(Painter const &functor)
Definition: miregl.h:45

Copyright © 2012-2017 Canonical Ltd.
Generated on Mon Oct 30 19:44:55 UTC 2017