aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scenegraph/openvg/qopenvgcontext_p.h
blob: 1079974065e690b6412fc4429d95aa55970a249d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only

#ifndef QOPENVGCONTEXT_H
#define QOPENVGCONTEXT_H

#include <QtGui/QWindow>
#include <QtGui/QImage>

#include <EGL/egl.h>
#include <VG/openvg.h>

QT_BEGIN_NAMESPACE

class QOpenVGContext
{
public:
    QOpenVGContext(QWindow *window);
    ~QOpenVGContext();

    void makeCurrent();
    void makeCurrent(EGLSurface surface);
    void doneCurrent();
    void swapBuffers();
    void swapBuffers(EGLSurface surface);


    QWindow *window() const;

    EGLDisplay eglDisplay() { return m_display; }
    EGLConfig eglConfig() { return m_config; }
    EGLContext eglContext() { return m_context; }

    QImage readFramebuffer(const QSize &size);

    void getConfigs();

    static void checkErrors();

private:
    EGLSurface m_surface;
    EGLDisplay m_display;
    EGLConfig m_config;
    EGLContext m_context;

    QWindow *m_window;

};

QT_END_NAMESPACE

#endif // QOPENVGCONTEXT_H