summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@nokia.com>2010-09-21 08:06:18 (GMT)
committerThiago Macieira <thiago.macieira@nokia.com>2010-09-21 08:06:18 (GMT)
commita4d1be727573a7a87c523a2ef28074c77d16f165 (patch)
treed4f8f218c41771ca17c7ab324390485af868fa8e /src/plugins
parentcd2fd21578a80bc5ac121c0419ee00b1799d0a60 (diff)
parent660ec910ef60513b511e2292255e53701dbb239b (diff)
downloadQt-a4d1be727573a7a87c523a2ef28074c77d16f165.zip
Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.gz
Qt-a4d1be727573a7a87c523a2ef28074c77d16f165.tar.bz2
Merge remote branch 'origin/4.7' into qt-master-from-4.7
Conflicts: src/corelib/kernel/qobject.h src/declarative/graphicsitems/qdeclarativeflickable.cpp src/declarative/graphicsitems/qdeclarativeflickable_p_p.h src/declarative/util/qdeclarativelistmodel.cpp
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/bearer/bearer.pro6
-rw-r--r--src/plugins/bearer/connman/qofonoservice_linux_p.h2
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp11
-rw-r--r--src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp2
-rw-r--r--src/plugins/bearer/symbian/3_2/3_2.pro12
-rw-r--r--src/plugins/bearer/symbian/symbian.pri6
-rw-r--r--src/plugins/bearer/symbian/symbian.pro7
-rw-r--r--src/plugins/bearer/symbian/symbian_3/symbian_3.pro18
-rw-r--r--src/plugins/gfxdrivers/directfb/directfb.pro2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp2
-rw-r--r--src/plugins/graphicssystems/graphicssystems.pro4
-rw-r--r--src/plugins/graphicssystems/meego/meego.pro13
-rw-r--r--src/plugins/graphicssystems/meego/qmeegoextensions.cpp129
-rw-r--r--src/plugins/graphicssystems/meego/qmeegoextensions.h88
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp247
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h85
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp58
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h54
-rw-r--r--src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp206
-rw-r--r--src/plugins/graphicssystems/meego/qmeegopixmapdata.h73
-rw-r--r--src/plugins/s60/s60.pro10
23 files changed, 1005 insertions, 34 deletions
diff --git a/src/plugins/bearer/bearer.pro b/src/plugins/bearer/bearer.pro
index bbe8ab1..d1d75f0 100644
--- a/src/plugins/bearer/bearer.pro
+++ b/src/plugins/bearer/bearer.pro
@@ -3,9 +3,9 @@ TEMPLATE = subdirs
contains(QT_CONFIG, dbus) {
contains(QT_CONFIG, icd) {
SUBDIRS += icd
- } else {
+ } else:linux* {
SUBDIRS += generic
- linux*:SUBDIRS += connman networkmanager
+ SUBDIRS += connman networkmanager
}
}
@@ -16,4 +16,4 @@ macx:contains(QT_CONFIG, corewlan):SUBDIRS += corewlan
macx:SUBDIRS += generic
symbian:SUBDIRS += symbian
-isEmpty(SUBDIRS):SUBDIRS += generic
+isEmpty(SUBDIRS):SUBDIRS = generic
diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h
index 4892666..0ac1e4a 100644
--- a/src/plugins/bearer/connman/qofonoservice_linux_p.h
+++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h
@@ -329,4 +329,6 @@ Q_SIGNALS:
void incomingMessage(const QString &message, const QVariantMap &info);
};
+QT_END_NAMESPACE
+
#endif //QOFONOSERVICE_H
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
index 29445ce..554f9b7 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
@@ -97,6 +97,10 @@ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
QNetworkManagerEngine::~QNetworkManagerEngine()
{
+ qDeleteAll(connections);
+ qDeleteAll(accessPoints);
+ qDeleteAll(wirelessDevices);
+ qDeleteAll(activeConnections);
}
void QNetworkManagerEngine::initialize()
@@ -389,7 +393,7 @@ void QNetworkManagerEngine::deviceRemoved(const QDBusObjectPath &path)
{
QMutexLocker locker(&mutex);
- delete wirelessDevices.value(path.path());
+ delete wirelessDevices.take(path.path());
}
void QNetworkManagerEngine::newConnection(const QDBusObjectPath &path,
@@ -455,6 +459,8 @@ void QNetworkManagerEngine::removeConnection(const QString &path)
QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.take(id);
+ connection->deleteLater();
+
locker.unlock();
emit configurationRemoved(ptr);
}
@@ -631,7 +637,8 @@ void QNetworkManagerEngine::removeAccessPoint(const QString &path,
locker.unlock();
emit configurationChanged(ptr);
- return;
+ locker.relock();
+ break;
}
}
} else {
diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
index f47c97c..499fe5a 100644
--- a/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+++ b/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
@@ -743,8 +743,6 @@ bool QNetworkManagerSettingsConnection::isAutoConnect()
quint64 QNetworkManagerSettingsConnection::getTimestamp()
{
- qDebug() << d->settingsMap.value(QLatin1String("connection"));
-
return d->settingsMap.value(QLatin1String("connection"))
.value(QLatin1String("timestamp")).toUInt();
}
diff --git a/src/plugins/bearer/symbian/3_2/3_2.pro b/src/plugins/bearer/symbian/3_2/3_2.pro
index 6f3ecaf..ac3b3f8 100644
--- a/src/plugins/bearer/symbian/3_2/3_2.pro
+++ b/src/plugins/bearer/symbian/3_2/3_2.pro
@@ -1,13 +1,15 @@
include(../symbian.pri)
symbian {
- exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \
- exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) {
+ contains(S60_VERSION, 3.1) {
+ is_using_gnupoc {
+ LIBS += -lapengine
+ } else {
+ LIBS += -lAPEngine
+ }
+ } else {
DEFINES += SNAP_FUNCTIONALITY_AVAILABLE
LIBS += -lcmmanager
- } else {
- # Fall back to 3_1 implementation on platforms that do not have cmmanager
- LIBS += -lapengine
}
}
diff --git a/src/plugins/bearer/symbian/symbian.pri b/src/plugins/bearer/symbian/symbian.pri
index 9b3f50c..e874945 100644
--- a/src/plugins/bearer/symbian/symbian.pri
+++ b/src/plugins/bearer/symbian/symbian.pri
@@ -22,11 +22,9 @@ LIBS += -lcommdb \
-lnetmeta
is_using_gnupoc {
- LIBS += -lconnmon \
- -lapsettingshandlerui
+ LIBS += -lconnmon
} else {
- LIBS += -lConnMon \
- -lApSettingsHandlerUI
+ LIBS += -lConnMon
}
QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/bearer
diff --git a/src/plugins/bearer/symbian/symbian.pro b/src/plugins/bearer/symbian/symbian.pro
index f320eb6..91f8217 100644
--- a/src/plugins/bearer/symbian/symbian.pro
+++ b/src/plugins/bearer/symbian/symbian.pro
@@ -1,3 +1,8 @@
TEMPLATE = subdirs
-SUBDIRS += 3_1 3_2 symbian_3 \ No newline at end of file
+contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ SUBDIRS += 3_1 3_2
+}
+
+# Symbian3 builds the default plugin for winscw so it is always needed
+SUBDIRS += symbian_3 \ No newline at end of file
diff --git a/src/plugins/bearer/symbian/symbian_3/symbian_3.pro b/src/plugins/bearer/symbian/symbian_3/symbian_3.pro
index fd66198..ef90ad2 100644
--- a/src/plugins/bearer/symbian/symbian_3/symbian_3.pro
+++ b/src/plugins/bearer/symbian/symbian_3/symbian_3.pro
@@ -1,22 +1,20 @@
include(../symbian.pri)
symbian {
- exists($${EPOCROOT}epoc32/release/winscw/udeb/cmmanager.lib)| \
- exists($${EPOCROOT}epoc32/release/armv5/lib/cmmanager.lib) {
+ contains(S60_VERSION, 3.1) {
+ is_using_gnupoc {
+ LIBS += -lapengine
+ } else {
+ LIBS += -lAPEngine
+ }
+ } else {
DEFINES += SNAP_FUNCTIONALITY_AVAILABLE
LIBS += -lcmmanager
- exists($$prependEpocroot($$MW_LAYER_PUBLIC_EXPORT_PATH(extendedconnpref.h))) {
+ !contains(S60_VERSION, 3.2):!contains(S60_VERSION, 5.0) {
DEFINES += OCC_FUNCTIONALITY_AVAILABLE
LIBS += -lextendedconnpref
}
- } else {
- # Fall back to 3_1 implementation on platforms that do not have cmmanager
- is_using_gnupoc {
- LIBS += -lapengine
- } else {
- LIBS += -lAPEngine
- }
}
}
diff --git a/src/plugins/gfxdrivers/directfb/directfb.pro b/src/plugins/gfxdrivers/directfb/directfb.pro
index 0706f01..d397050 100644
--- a/src/plugins/gfxdrivers/directfb/directfb.pro
+++ b/src/plugins/gfxdrivers/directfb/directfb.pro
@@ -11,5 +11,5 @@ SOURCES += qdirectfbscreenplugin.cpp
QMAKE_CXXFLAGS += $$QT_CFLAGS_DIRECTFB
LIBS += $$QT_LIBS_DIRECTFB
-DEFINES += $$QT_DEFINES_DIRECTFB QT_DIRECTFB_PLUGIN
+DEFINES += $$QT_DEFINES_DIRECTFB
contains(gfx-plugins, directfb):DEFINES += QT_QWS_DIRECTFB
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index d5f0d42..4869eba 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -978,7 +978,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m
break;
case QPainter::CompositionMode_SourceOver:
compositionModeStatus &= ~PorterDuff_AlwaysBlend;
- surface->SetPorterDuff(surface, DSPD_SRC_OVER);
+ surface->SetPorterDuff(surface, DSPD_NONE);
break;
case QPainter::CompositionMode_DestinationOver:
surface->SetPorterDuff(surface, DSPD_DST_OVER);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index f704432..c0d96d7 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -585,7 +585,6 @@ void QDirectFBPixmapData::invalidate()
imageFormat = QImage::Format_Invalid;
}
-#ifndef QT_DIRECTFB_PLUGIN
Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pixmap)
{
const QPixmapData *data = pixmap.pixmapData();
@@ -594,7 +593,6 @@ Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_pixmap(const QPixmap &pix
const QDirectFBPixmapData *dfbData = static_cast<const QDirectFBPixmapData*>(data);
return dfbData->directFBSurface();
}
-#endif
QT_END_NAMESPACE
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index cffd4e3..bf6164d 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -1790,7 +1790,6 @@ IDirectFBSurface *QDirectFBScreen::subSurfaceForWidget(const QWidget *widget, co
}
#endif
-#ifndef QT_DIRECTFB_PLUGIN
Q_GUI_EXPORT IDirectFBSurface *qt_directfb_surface_for_widget(const QWidget *widget, QRect *rect)
{
return QDirectFBScreen::instance() ? QDirectFBScreen::instance()->surfaceForWidget(widget, rect) : 0;
@@ -1808,7 +1807,6 @@ Q_GUI_EXPORT IDirectFBWindow *qt_directfb_window_for_widget(const QWidget *widge
}
#endif
-#endif
QT_END_NAMESPACE
diff --git a/src/plugins/graphicssystems/graphicssystems.pro b/src/plugins/graphicssystems/graphicssystems.pro
index 0788933..29a1f34 100644
--- a/src/plugins/graphicssystems/graphicssystems.pro
+++ b/src/plugins/graphicssystems/graphicssystems.pro
@@ -7,3 +7,7 @@ contains(QT_CONFIG, shivavg) {
# Only works under X11 at present
!win32:!embedded:!mac:SUBDIRS += shivavg
}
+
+!win32:!embedded:!mac:!symbian:CONFIG += x11
+
+x11:contains(QT_CONFIG, opengles2):contains(QT_CONFIG, egl):SUBDIRS += meego
diff --git a/src/plugins/graphicssystems/meego/meego.pro b/src/plugins/graphicssystems/meego/meego.pro
new file mode 100644
index 0000000..d750d34
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/meego.pro
@@ -0,0 +1,13 @@
+TARGET = qmeegographicssystem
+include(../../qpluginbase.pri)
+
+QT += gui opengl
+
+QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/graphicssystems
+
+HEADERS = qmeegographicssystem.h qmeegopixmapdata.h qmeegoextensions.h
+SOURCES = qmeegographicssystem.cpp qmeegographicssystem.h qmeegographicssystemplugin.h qmeegographicssystemplugin.cpp qmeegopixmapdata.h qmeegopixmapdata.cpp qmeegoextensions.h qmeegoextensions.cpp
+
+target.path += $$[QT_INSTALL_PLUGINS]/graphicssystems
+INSTALLS += target
+
diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
new file mode 100644
index 0000000..e7f6439
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
@@ -0,0 +1,129 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegoextensions.h"
+#include <private/qeglcontext_p.h>
+#include <private/qpixmapdata_gl_p.h>
+
+bool QMeeGoExtensions::initialized = false;
+bool QMeeGoExtensions::hasImageShared = false;
+bool QMeeGoExtensions::hasSurfaceScaling = false;
+
+/* Extension funcs */
+
+typedef EGLBoolean (EGLAPIENTRY *eglQueryImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint, EGLint*);
+typedef EGLNativeSharedImageTypeNOK (EGLAPIENTRY *eglCreateSharedImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint*);
+typedef EGLBoolean (EGLAPIENTRY *eglDestroySharedImageNOKFunc)(EGLDisplay, EGLNativeSharedImageTypeNOK);
+typedef EGLBoolean (EGLAPIENTRY *eglSetSurfaceScalingNOKFunc)(EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint);
+
+static eglQueryImageNOKFunc _eglQueryImageNOK = 0;
+static eglCreateSharedImageNOKFunc _eglCreateSharedImageNOK = 0;
+static eglDestroySharedImageNOKFunc _eglDestroySharedImageNOK = 0;
+static eglSetSurfaceScalingNOKFunc _eglSetSurfaceScalingNOK = 0;
+
+/* Public */
+
+void QMeeGoExtensions::ensureInitialized()
+{
+ if (!initialized)
+ initialize();
+
+ initialized = true;
+}
+
+EGLNativeSharedImageTypeNOK QMeeGoExtensions::eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props)
+{
+ if (! hasImageShared)
+ qFatal("EGL_NOK_image_shared not found but trying to use capability!");
+
+ return _eglCreateSharedImageNOK(dpy, image, props);
+}
+
+bool QMeeGoExtensions::eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v)
+{
+ if (! hasImageShared)
+ qFatal("EGL_NOK_image_shared not found but trying to use capability!");
+
+ return _eglQueryImageNOK(dpy, image, prop, v);
+}
+
+bool QMeeGoExtensions::eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img)
+{
+ if (! hasImageShared)
+ qFatal("EGL_NOK_image_shared not found but trying to use capability!");
+
+ return _eglDestroySharedImageNOK(dpy, img);
+}
+
+bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height)
+{
+ if (! hasSurfaceScaling)
+ qFatal("EGL_NOK_surface_scaling not found but trying to use capability!");
+
+ return _eglSetSurfaceScalingNOK(dpy, surface, x, y, width, height);
+}
+
+/* Private */
+
+void QMeeGoExtensions::initialize()
+{
+ QGLContext *ctx = (QGLContext *) QGLContext::currentContext();
+ qt_resolve_eglimage_gl_extensions(ctx);
+
+ if (QEgl::hasExtension("EGL_NOK_image_shared")) {
+ qDebug("MeegoGraphics: found EGL_NOK_image_shared");
+ _eglQueryImageNOK = (eglQueryImageNOKFunc) eglGetProcAddress("eglQueryImageNOK");
+ _eglCreateSharedImageNOK = (eglCreateSharedImageNOKFunc) eglGetProcAddress("eglCreateSharedImageNOK");
+ _eglDestroySharedImageNOK = (eglDestroySharedImageNOKFunc) eglGetProcAddress("eglDestroySharedImageNOK");
+
+ Q_ASSERT(_eglQueryImageNOK && _eglCreateSharedImageNOK && _eglDestroySharedImageNOK);
+ hasImageShared = true;
+ }
+
+ if (QEgl::hasExtension("EGL_NOK_surface_scaling")) {
+ qDebug("MeegoGraphics: found EGL_NOK_surface_scaling");
+ _eglSetSurfaceScalingNOK = (eglSetSurfaceScalingNOKFunc) eglGetProcAddress("eglSetSurfaceScalingNOK");
+
+ Q_ASSERT(_eglSetSurfaceScalingNOK);
+ hasSurfaceScaling = true;
+ }
+}
+
diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h
new file mode 100644
index 0000000..f1a74f5
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/qmeegoextensions.h
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MEXTENSIONS_H
+#define MEXTENSIONS_H
+
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
+#include <private/qgl_p.h>
+#include <private/qeglcontext_p.h>
+#include <private/qpixmapdata_gl_p.h>
+
+/* Extensions decls */
+
+#ifndef EGL_SHARED_IMAGE_NOK
+#define EGL_SHARED_IMAGE_NOK 0x30DA
+typedef void* EGLNativeSharedImageTypeNOK;
+#endif
+
+#ifndef EGL_GL_TEXTURE_2D_KHR
+#define EGL_GL_TEXTURE_2D_KHR 0x30B1
+#endif
+
+#ifndef EGL_FIXED_WIDTH_NOK
+#define EGL_FIXED_WIDTH_NOK 0x30DB
+#define EGL_FIXED_HEIGHT_NOK 0x30DC
+#endif
+
+/* Class */
+
+class QMeeGoExtensions
+{
+public:
+ static void ensureInitialized();
+
+ static EGLNativeSharedImageTypeNOK eglCreateSharedImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint *props);
+ static bool eglQueryImageNOK(EGLDisplay dpy, EGLImageKHR image, EGLint prop, EGLint *v);
+ static bool eglDestroySharedImageNOK(EGLDisplay dpy, EGLNativeSharedImageTypeNOK img);
+ static bool eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surface, int x, int y, int width, int height);
+
+private:
+ static void initialize();
+
+ static bool initialized;
+ static bool hasImageShared;
+ static bool hasSurfaceScaling;
+};
+
+#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
new file mode 100644
index 0000000..2a64d49
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -0,0 +1,247 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include <private/qpixmap_raster_p.h>
+#include <private/qwindowsurface_gl_p.h>
+#include <private/qegl_p.h>
+#include <private/qglextensions_p.h>
+#include <private/qgl_p.h>
+#include <private/qimagepixmapcleanuphooks_p.h>
+#include <private/qapplication_p.h>
+#include <private/qgraphicssystem_runtime_p.h>
+#include <private/qimage_p.h>
+#include <private/qeglproperties_p.h>
+#include <private/qeglcontext_p.h>
+
+#include "qmeegopixmapdata.h"
+#include "qmeegographicssystem.h"
+#include "qmeegoextensions.h"
+
+bool QMeeGoGraphicsSystem::surfaceWasCreated = false;
+
+QMeeGoGraphicsSystem::QMeeGoGraphicsSystem()
+{
+ qDebug("Using the meego graphics system");
+}
+
+QMeeGoGraphicsSystem::~QMeeGoGraphicsSystem()
+{
+ qDebug("Meego graphics system destroyed");
+ qt_destroy_gl_share_widget();
+}
+
+QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
+{
+ QMeeGoGraphicsSystem::surfaceWasCreated = true;
+ QWindowSurface *surface = new QGLWindowSurface(widget);
+ return surface;
+}
+
+QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
+{
+ // Long story short: without this it's possible to hit an
+ // unitialized paintDevice due to a Qt bug too complex to even
+ // explain here... not to mention fix without going crazy.
+ // MDK
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+
+ return new QRasterPixmapData(type);
+}
+
+QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData *origin)
+{
+ // If the pixmap is a raster type...
+ // and if the pixmap pointer matches our mapping...
+ // create a shared image instead with the given handle.
+
+ if (origin->classId() == QPixmapData::RasterClass) {
+ QRasterPixmapData *rasterClass = static_cast <QRasterPixmapData *> (origin);
+ void *rawResource = static_cast <void *> (rasterClass->buffer()->data_ptr()->data);
+
+ if (QMeeGoPixmapData::sharedImagesMap.contains(rawResource))
+ return new QMeeGoPixmapData();
+ }
+
+ return new QRasterPixmapData(origin->pixelType());
+}
+
+QPixmapData* QMeeGoGraphicsSystem::wrapPixmapData(QPixmapData *pmd)
+{
+ QString name = QApplicationPrivate::instance()->graphics_system_name;
+ if (name == "runtime") {
+ QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system;
+ QRuntimePixmapData *rt = new QRuntimePixmapData(rsystem, pmd->pixelType());;
+ rt->m_data = pmd;
+ rt->readBackInfo();
+ rsystem->m_pixmapDatas << rt;
+ return rt;
+ } else
+ return pmd;
+}
+
+void QMeeGoGraphicsSystem::setSurfaceFixedSize(int /*width*/, int /*height*/)
+{
+ if (QMeeGoGraphicsSystem::surfaceWasCreated)
+ qWarning("Trying to set surface fixed size but surface already created!");
+
+#ifdef QT_WAS_PATCHED
+ QEglProperties *properties = new QEglProperties();
+ properties->setValue(EGL_FIXED_WIDTH_NOK, width);
+ properties->setValue(EGL_FIXED_HEIGHT_NOK, height);
+ QGLContextPrivate::setExtraWindowSurfaceCreationProps(properties);
+#endif
+}
+
+void QMeeGoGraphicsSystem::setSurfaceScaling(int x, int y, int width, int height)
+{
+ QMeeGoExtensions::ensureInitialized();
+ QMeeGoExtensions::eglSetSurfaceScalingNOK(QEgl::display(), QEglContext::currentContext(QEgl::OpenGL)->currentSurface, x, y, width, height);
+}
+
+void QMeeGoGraphicsSystem::setTranslucent(bool translucent)
+{
+ QGLWindowSurface::surfaceFormat.setSampleBuffers(false);
+ QGLWindowSurface::surfaceFormat.setSamples(0);
+ QGLWindowSurface::surfaceFormat.setAlpha(translucent);
+}
+
+QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
+{
+ if (softImage.format() != QImage::Format_ARGB32_Premultiplied &&
+ softImage.format() != QImage::Format_ARGB32) {
+ qFatal("For egl shared images, the soft image has to be ARGB32 or ARGB32_Premultiplied");
+ return NULL;
+ }
+
+ if (QMeeGoGraphicsSystem::meeGoRunning()) {
+ QMeeGoPixmapData *pmd = new QMeeGoPixmapData;
+ pmd->fromEGLSharedImage(handle, softImage);
+ return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
+ } else {
+ QRasterPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType);
+ pmd->fromImage(softImage, Qt::NoOpaqueDetection);
+
+ // Make sure that the image was not converted in any way
+ if (pmd->buffer()->data_ptr()->data !=
+ const_cast<QImage &>(softImage).data_ptr()->data)
+ qFatal("Iternal misalignment of raster data detected. Prolly a QImage copy fail.");
+
+ QMeeGoPixmapData::registerSharedImage(handle, softImage);
+ return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
+ }
+}
+
+void QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(QPixmap *pixmap)
+{
+ QMeeGoPixmapData *pmd = (QMeeGoPixmapData *) pixmap->pixmapData();
+
+ // Basic sanity check to make sure this is really a QMeeGoPixmapData...
+ if (pmd->classId() != QPixmapData::OpenGLClass)
+ qFatal("Trying to updated EGLSharedImage pixmap but it's not really a shared image pixmap!");
+
+ pmd->updateFromSoftImage();
+}
+
+QPixmapData *QMeeGoGraphicsSystem::pixmapDataWithGLTexture(int w, int h)
+{
+ QGLPixmapData *pmd = new QGLPixmapData(QPixmapData::PixmapType);
+ pmd->resize(w, h);
+ return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
+}
+
+bool QMeeGoGraphicsSystem::meeGoRunning()
+{
+ if (! QApplicationPrivate::instance()) {
+ qWarning("Application not running just yet... hard to know what system running!");
+ return false;
+ }
+
+ QString name = QApplicationPrivate::instance()->graphics_system_name;
+ if (name == "runtime") {
+ QRuntimeGraphicsSystem *rsystem = (QRuntimeGraphicsSystem *) QApplicationPrivate::instance()->graphics_system;
+ name = rsystem->graphicsSystemName();
+ }
+
+ return (name == "meego");
+}
+
+/* C API */
+
+int qt_meego_image_to_egl_shared_image(const QImage &image)
+{
+ return QMeeGoPixmapData::imageToEGLSharedImage(image);
+}
+
+QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage)
+{
+ return QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(handle, softImage);
+}
+
+QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h)
+{
+ return QMeeGoGraphicsSystem::pixmapDataWithGLTexture(w, h);
+}
+
+bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle)
+{
+ return QMeeGoPixmapData::destroyEGLSharedImage(handle);
+}
+
+void qt_meego_set_surface_fixed_size(int width, int height)
+{
+ QMeeGoGraphicsSystem::setSurfaceFixedSize(width, height);
+}
+
+void qt_meego_set_surface_scaling(int x, int y, int width, int height)
+{
+ QMeeGoGraphicsSystem::setSurfaceScaling(x, y, width, height);
+}
+
+void qt_meego_set_translucent(bool translucent)
+{
+ QMeeGoGraphicsSystem::setTranslucent(translucent);
+}
+
+void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap)
+{
+ QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(pixmap);
+}
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
new file mode 100644
index 0000000..905f0c3
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MGRAPHICSSYSTEM_H
+#define MGRAPHICSSYSTEM_H
+
+#include <private/qgraphicssystem_p.h>
+
+class QMeeGoGraphicsSystem : public QGraphicsSystem
+{
+public:
+ QMeeGoGraphicsSystem();
+ ~QMeeGoGraphicsSystem();
+
+ virtual QWindowSurface *createWindowSurface(QWidget *widget) const;
+ virtual QPixmapData *createPixmapData(QPixmapData::PixelType) const;
+ virtual QPixmapData *createPixmapData(QPixmapData *origin);
+
+ static QPixmapData *wrapPixmapData(QPixmapData *pmd);
+ static void setSurfaceFixedSize(int width, int height);
+ static void setSurfaceScaling(int x, int y, int width, int height);
+ static void setTranslucent(bool translucent);
+
+ static QPixmapData *pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+ static QPixmapData *pixmapDataWithGLTexture(int w, int h);
+ static void updateEGLSharedImagePixmap(QPixmap *pixmap);
+
+private:
+ static bool meeGoRunning();
+
+ static bool surfaceWasCreated;
+};
+
+/* C api */
+
+extern "C" {
+ Q_DECL_EXPORT int qt_meego_image_to_egl_shared_image(const QImage &image);
+ Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const QImage &softImage);
+ Q_DECL_EXPORT QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h);
+ Q_DECL_EXPORT void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap);
+ Q_DECL_EXPORT bool qt_meego_destroy_egl_shared_image(Qt::HANDLE handle);
+ Q_DECL_EXPORT void qt_meego_set_surface_fixed_size(int width, int height);
+ Q_DECL_EXPORT void qt_meego_set_surface_scaling(int x, int y, int width, int height);
+ Q_DECL_EXPORT void qt_meego_set_translucent(bool translucent);
+}
+
+#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp
new file mode 100644
index 0000000..7c142eb
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QDebug>
+#include "qmeegographicssystemplugin.h"
+#include "qmeegographicssystem.h"
+
+QStringList QMeeGoGraphicsSystemPlugin::keys() const
+{
+ QStringList list;
+ list << "meego";
+ return list;
+}
+
+QGraphicsSystem *QMeeGoGraphicsSystemPlugin::create(const QString&)
+{
+ return new QMeeGoGraphicsSystem;
+}
+
+Q_EXPORT_PLUGIN2(meego, QMeeGoGraphicsSystemPlugin)
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h
new file mode 100644
index 0000000..336458f
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystemplugin.h
@@ -0,0 +1,54 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MGRAPHICSSYSTEMPLUGIN_H
+#define MGRAPHICSSYSTEMPLUGIN_H
+
+#include <private/qgraphicssystemplugin_p.h>
+
+class QMeeGoGraphicsSystemPlugin : public QGraphicsSystemPlugin
+{
+public:
+ virtual QStringList keys() const;
+ virtual QGraphicsSystem *create(const QString&);
+};
+
+#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
new file mode 100644
index 0000000..33611dc
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
@@ -0,0 +1,206 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qmeegopixmapdata.h"
+#include "qmeegoextensions.h"
+#include <private/qimage_p.h>
+#include <private/qwindowsurface_gl_p.h>
+#include <private/qeglcontext_p.h>
+#include <private/qapplication_p.h>
+#include <private/qgraphicssystem_runtime_p.h>
+
+static EGLint preserved_image_attribs[] = { EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE };
+
+QHash <void*, QMeeGoImageInfo*> QMeeGoPixmapData::sharedImagesMap;
+
+/* Public */
+
+QMeeGoPixmapData::QMeeGoPixmapData() : QGLPixmapData(QPixmapData::PixmapType)
+{
+}
+
+void QMeeGoPixmapData::fromTexture(GLuint textureId, int w, int h, bool alpha)
+{
+ resize(w, h);
+ texture()->id = textureId;
+ m_hasAlpha = alpha;
+ softImage = QImage();
+}
+
+QImage QMeeGoPixmapData::toImage() const
+{
+ return softImage;
+}
+
+void QMeeGoPixmapData::fromImage(const QImage &image,
+ Qt::ImageConversionFlags flags)
+{
+ void *rawResource = static_cast <void *> (((QImage &) image).data_ptr()->data);
+
+ if (sharedImagesMap.contains(rawResource)) {
+ QMeeGoImageInfo *info = sharedImagesMap.value(rawResource);
+ fromEGLSharedImage(info->handle, image);
+ } else {
+ // This should *never* happen since the graphics system should never
+ // create a QMeeGoPixmapData for an origin that doesn't contain a raster
+ // image we know about. But...
+ qWarning("QMeeGoPixmapData::fromImage called on non-know resource. Falling back...");
+ QGLPixmapData::fromImage(image, flags);
+ }
+}
+
+void QMeeGoPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si)
+{
+ if (si.isNull())
+ qFatal("Trying to build pixmap with an empty/null softimage!");
+
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+
+ QMeeGoExtensions::ensureInitialized();
+
+ bool textureIsBound = false;
+ GLuint newTextureId;
+ GLint newWidth, newHeight;
+
+ glGenTextures(1, &newTextureId);
+ glBindTexture(GL_TEXTURE_2D, newTextureId);
+
+ glFinish();
+ EGLImageKHR image = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_SHARED_IMAGE_NOK,
+ (EGLClientBuffer)handle, preserved_image_attribs);
+
+ if (image != EGL_NO_IMAGE_KHR) {
+ glFinish();
+ glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
+ GLint err = glGetError();
+ if (err == GL_NO_ERROR)
+ textureIsBound = true;
+
+ QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_WIDTH, &newWidth);
+ QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), image, EGL_HEIGHT, &newHeight);
+
+ QEgl::eglDestroyImageKHR(QEgl::display(), image);
+ glFinish();
+ }
+
+ if (textureIsBound) {
+ // FIXME Remove this ugly hasAlphaChannel check when Qt lands the NoOpaqueCheck flag fix
+ // for QGLPixmapData.
+ fromTexture(newTextureId, newWidth, newHeight,
+ (si.hasAlphaChannel() && const_cast<QImage &>(si).data_ptr()->checkForAlphaPixels()));
+ softImage = si;
+ QMeeGoPixmapData::registerSharedImage(handle, softImage);
+ } else {
+ qWarning("Failed to create a texture from a shared image!");
+ glDeleteTextures(1, &newTextureId);
+ }
+}
+
+Qt::HANDLE QMeeGoPixmapData::imageToEGLSharedImage(const QImage &image)
+{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+
+ QMeeGoExtensions::ensureInitialized();
+
+ glFinish();
+ QGLPixmapData pixmapData(QPixmapData::PixmapType);
+ pixmapData.fromImage(image, 0);
+ GLuint textureId = pixmapData.bind();
+
+ glFinish();
+ EGLImageKHR eglimage = QEgl::eglCreateImageKHR(QEgl::display(), QEglContext::currentContext(QEgl::OpenGL)->context(),
+ EGL_GL_TEXTURE_2D_KHR,
+ (EGLClientBuffer) textureId,
+ preserved_image_attribs);
+ glFinish();
+
+ if (eglimage) {
+ EGLNativeSharedImageTypeNOK handle = QMeeGoExtensions::eglCreateSharedImageNOK(QEgl::display(), eglimage, NULL);
+ QEgl::eglDestroyImageKHR(QEgl::display(), eglimage);
+ glFinish();
+ return (Qt::HANDLE) handle;
+ } else {
+ qWarning("Failed to create shared image from pixmap/texture!");
+ return 0;
+ }
+}
+
+void QMeeGoPixmapData::updateFromSoftImage()
+{
+ m_dirty = true;
+ m_source = softImage;
+ ensureCreated();
+
+ if (softImage.width() != w || softImage.height() != h)
+ qWarning("Ooops, looks like softImage changed dimensions since last updated! Corruption ahead?!");
+}
+
+bool QMeeGoPixmapData::destroyEGLSharedImage(Qt::HANDLE h)
+{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QMeeGoExtensions::ensureInitialized();
+
+ QMutableHashIterator <void*, QMeeGoImageInfo*> i(sharedImagesMap);
+ while (i.hasNext()) {
+ i.next();
+ if (i.value()->handle == h)
+ i.remove();
+ }
+
+ return QMeeGoExtensions::eglDestroySharedImageNOK(QEgl::display(), (EGLNativeSharedImageTypeNOK) h);
+}
+
+void QMeeGoPixmapData::registerSharedImage(Qt::HANDLE handle, const QImage &si)
+{
+ void *raw = static_cast <void *> (((QImage) si).data_ptr()->data);
+ QMeeGoImageInfo *info;
+
+ if (! sharedImagesMap.contains(raw)) {
+ info = new QMeeGoImageInfo;
+ info->handle = handle;
+ info->rawFormat = si.format();
+ sharedImagesMap.insert(raw, info);
+ } else {
+ info = sharedImagesMap.value(raw);
+ if (info->handle != handle || info->rawFormat != si.format())
+ qWarning("Inconsistency detected: overwriting entry in sharedImagesMap but handle/format different");
+ }
+}
diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h b/src/plugins/graphicssystems/meego/qmeegopixmapdata.h
new file mode 100644
index 0000000..8af33bd
--- /dev/null
+++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef MPIXMAPDATA_H
+#define MPIXMAPDATA_H
+
+#include <private/qpixmapdata_gl_p.h>
+
+struct QMeeGoImageInfo
+{
+ Qt::HANDLE handle;
+ QImage::Format rawFormat;
+};
+
+class QMeeGoPixmapData : public QGLPixmapData
+{
+public:
+ QMeeGoPixmapData();
+ void fromTexture(GLuint textureId, int w, int h, bool alpha);
+
+ virtual void fromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+ virtual void fromImage (const QImage &image, Qt::ImageConversionFlags flags);
+ virtual QImage toImage() const;
+ virtual void updateFromSoftImage();
+
+ QImage softImage;
+
+ static QHash <void*, QMeeGoImageInfo*> sharedImagesMap;
+
+ static Qt::HANDLE imageToEGLSharedImage(const QImage &image);
+ static bool destroyEGLSharedImage(Qt::HANDLE h);
+ static void registerSharedImage(Qt::HANDLE handle, const QImage &si);
+};
+
+#endif
diff --git a/src/plugins/s60/s60.pro b/src/plugins/s60/s60.pro
index 8ae639c..c999fff 100644
--- a/src/plugins/s60/s60.pro
+++ b/src/plugins/s60/s60.pro
@@ -1,3 +1,11 @@
TEMPLATE = subdirs
-symbian:SUBDIRS = 3_1 3_2 5_0
+
+symbian {
+ contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) {
+ SUBDIRS += 3_1 3_2
+ }
+
+ # 5.0 is used also for Symbian3 and later
+ SUBDIRS += 5_0
+} \ No newline at end of file