| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** All rights reserved.
|
|---|
| 5 | ** Contact: Nokia Corporation ([email protected])
|
|---|
| 6 | **
|
|---|
| 7 | ** This file is part of the plugins of the Qt Toolkit.
|
|---|
| 8 | **
|
|---|
| 9 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 10 | ** Commercial Usage
|
|---|
| 11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 12 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 13 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 14 | ** a written agreement between you and Nokia.
|
|---|
| 15 | **
|
|---|
| 16 | ** GNU Lesser General Public License Usage
|
|---|
| 17 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 18 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 19 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 20 | ** packaging of this file. Please review the following information to
|
|---|
| 21 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 22 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 23 | **
|
|---|
| 24 | ** In addition, as a special exception, Nokia gives you certain additional
|
|---|
| 25 | ** rights. These rights are described in the Nokia Qt LGPL Exception
|
|---|
| 26 | ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you have questions regarding the use of this file, please contact
|
|---|
| 37 | ** Nokia at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 |
|
|---|
| 42 | #ifndef MGRAPHICSSYSTEM_H
|
|---|
| 43 | #define MGRAPHICSSYSTEM_H
|
|---|
| 44 |
|
|---|
| 45 | #include <private/qgraphicssystem_p.h>
|
|---|
| 46 | #include <EGL/egl.h>
|
|---|
| 47 | #include <GLES2/gl2.h>
|
|---|
| 48 | #include <GLES2/gl2ext.h>
|
|---|
| 49 |
|
|---|
| 50 | class QMeeGoGraphicsSystem : public QGraphicsSystem
|
|---|
| 51 | {
|
|---|
| 52 | public:
|
|---|
| 53 | QMeeGoGraphicsSystem();
|
|---|
| 54 | ~QMeeGoGraphicsSystem();
|
|---|
| 55 |
|
|---|
| 56 | virtual QWindowSurface *createWindowSurface(QWidget *widget) const;
|
|---|
| 57 | virtual QPixmapData *createPixmapData(QPixmapData::PixelType) const;
|
|---|
| 58 | virtual QPixmapData *createPixmapData(QPixmapData *origin);
|
|---|
| 59 |
|
|---|
| 60 | static QPixmapData *wrapPixmapData(QPixmapData *pmd);
|
|---|
| 61 | static void setSurfaceFixedSize(int width, int height);
|
|---|
| 62 | static void setSurfaceScaling(int x, int y, int width, int height);
|
|---|
| 63 | static void setTranslucent(bool translucent);
|
|---|
| 64 |
|
|---|
| 65 | static QPixmapData *pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
|
|---|
| 66 | static QPixmapData *pixmapDataFromEGLImage(Qt::HANDLE handle);
|
|---|
| 67 | static QPixmapData *pixmapDataWithGLTexture(int w, int h);
|
|---|
| 68 | static void updateEGLSharedImagePixmap(QPixmap *pixmap);
|
|---|
| 69 |
|
|---|
| 70 | static QPixmapData *pixmapDataWithNewLiveTexture(int w, int h, QImage::Format format);
|
|---|
| 71 | static QPixmapData *pixmapDataFromLiveTextureHandle(Qt::HANDLE handle);
|
|---|
| 72 | static QImage *lockLiveTexture(QPixmap* pixmap, void* fenceSync);
|
|---|
| 73 | static bool releaseLiveTexture(QPixmap *pixmap, QImage *image);
|
|---|
| 74 | static Qt::HANDLE getLiveTextureHandle(QPixmap *pixmap);
|
|---|
| 75 |
|
|---|
| 76 | static void* createFenceSync();
|
|---|
| 77 | static void destroyFenceSync(void* fenceSync);
|
|---|
| 78 |
|
|---|
| 79 | private:
|
|---|
| 80 | static bool meeGoRunning();
|
|---|
| 81 | static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap);
|
|---|
| 82 | static void destroySurfaceForLiveTexturePixmap(QPixmapData* pmd);
|
|---|
| 83 |
|
|---|
| 84 | static bool surfaceWasCreated;
|
|---|
| 85 | static QHash <Qt::HANDLE, QPixmap*> liveTexturePixmaps;
|
|---|
| 86 | };
|
|---|
| 87 |
|
|---|
| 88 | /* C api */
|
|---|
| 89 |
|
|---|
| 90 | extern "C" {
|
|---|
| 91 | Q_DECL_EXPORT int qt_meego_image_to_egl_shared_image(const QImage &image);
|
|---|
| 92 | Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage);
|
|---|
| 93 | Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h);
|
|---|
| 94 | Q_DECL_EXPORT void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap);
|
|---|
| 95 | Q_DECL_EXPORT bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle);
|
|---|
| 96 | Q_DECL_EXPORT void qt_meego_set_surface_fixed_size(int width, int height);
|
|---|
| 97 | Q_DECL_EXPORT void qt_meego_set_surface_scaling(int x, int y, int width, int height);
|
|---|
| 98 | Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent);
|
|---|
| 99 | Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_new_live_texture(int w, int h, QImage::Format format);
|
|---|
| 100 | Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_live_texture_handle(Qt::HANDLE handle);
|
|---|
| 101 | Q_DECL_EXPORT QImage* qt_meego_live_texture_lock(QPixmap *pixmap, void *fenceSync);
|
|---|
| 102 | Q_DECL_EXPORT bool qt_meego_live_texture_release(QPixmap *pixmap, QImage *image);
|
|---|
| 103 | Q_DECL_EXPORT Qt::HANDLE qt_meego_live_texture_get_handle(QPixmap *pixmap);
|
|---|
| 104 | Q_DECL_EXPORT void* qt_meego_create_fence_sync(void);
|
|---|
| 105 | Q_DECL_EXPORT void qt_meego_destroy_fence_sync(void* fs);
|
|---|
| 106 | }
|
|---|
| 107 |
|
|---|
| 108 | #endif
|
|---|