/*
* Copyright © 2015 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
#ifndef UNITYSYSTEMCOMPOSITOR_MIREGL_H
#define UNITYSYSTEMCOMPOSITOR_MIREGL_H
#include
#include
#include "mir_toolkit/mir_client_library.h"
#include
#include
class MirEglApp;
class MirEglSurface;
std::shared_ptr make_mir_eglapp(
MirConnection* const connection,
MirPixelFormat const& pixel_format);
class MirEglSurface
{
public:
MirEglSurface(
std::shared_ptr const& mir_egl_app,
MirSurfaceParameters const& surfaceparm,
int swapinterval);
~MirEglSurface();
template
void paint(Painter const& functor)
{
egl_make_current();
functor(width(), height());
swap_buffers();
}
private:
void egl_make_current();
void swap_buffers();
unsigned int width() const;
unsigned int height() const;
std::shared_ptr const mir_egl_app;
MirSurface* const surface;
EGLSurface const eglsurface;
int width_;
int height_;
};
#endif //UNITYSYSTEMCOMPOSITOR_MIREGL_H