summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-08 00:18:25 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-08 00:18:25 (GMT)
commit7c555955e96bc188bfebdea2cd066d871f151b59 (patch)
tree71e8765fa2f82878cbb2b5505857bd5f09595228
parent7b78eab2c04ed0388a2ffdf43bbe5ca37ccc8167 (diff)
parent558acd8c8ff94c6fd1e96514a2dffb587a66bb2f (diff)
downloadQt-7c555955e96bc188bfebdea2cd066d871f151b59.zip
Qt-7c555955e96bc188bfebdea2cd066d871f151b59.tar.gz
Qt-7c555955e96bc188bfebdea2cd066d871f151b59.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp76
-rw-r--r--src/gui/image/qpixmap_x11_p.h1
-rw-r--r--src/plugins/graphicssystems/meego/qmeegoextensions.cpp32
-rw-r--r--src/plugins/graphicssystems/meego/qmeegoextensions.h15
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp203
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h21
-rw-r--r--src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp30
-rw-r--r--src/plugins/graphicssystems/meego/qmeegopixmapdata.h1
-rw-r--r--tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp76
-rw-r--r--tools/designer/src/plugins/plugins.pro2
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp9
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h7
-rw-r--r--tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro4
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoliveimage.cpp115
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoliveimage.h106
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoliveimage_p.h63
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp150
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap.h35
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h11
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.cpp92
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.h11
-rw-r--r--tools/qtconfig/paletteeditoradvanced.cpp1
23 files changed, 637 insertions, 426 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 810055f..83aafe9 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -2125,7 +2125,7 @@ void QGraphicsItem::setToolTip(const QString &toolTip)
\snippet doc/src/snippets/code/src_gui_graphicsview_qgraphicsitem.cpp 2
- If no cursor has been set, the parent's cursor is used.
+ If no cursor has been set, the cursor of the item beneath is used.
\sa setCursor(), hasCursor(), unsetCursor(), QWidget::cursor,
QApplication::overrideCursor()
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 733d282..5b1da9e 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -4362,6 +4362,50 @@ static void _q_paintIntoCache(QPixmap *pix, QGraphicsItem *item, const QRegion &
}
}
+// Copied from qpaintengine_vg.cpp
+// Returns true for 90, 180, and 270 degree rotations.
+static inline bool transformIsSimple(const QTransform& transform)
+{
+ QTransform::TransformationType type = transform.type();
+ if (type == QTransform::TxNone || type == QTransform::TxTranslate) {
+ return true;
+ } else if (type == QTransform::TxScale) {
+ // Check for 0 and 180 degree rotations.
+ // (0 might happen after 4 rotations of 90 degrees).
+ qreal m11 = transform.m11();
+ qreal m12 = transform.m12();
+ qreal m21 = transform.m21();
+ qreal m22 = transform.m22();
+ if (m12 == 0.0f && m21 == 0.0f) {
+ if (m11 == 1.0f && m22 == 1.0f)
+ return true; // 0 degrees
+ else if (m11 == -1.0f && m22 == -1.0f)
+ return true; // 180 degrees.
+ if(m11 == 1.0f && m22 == -1.0f)
+ return true; // 0 degrees inverted y.
+ else if(m11 == -1.0f && m22 == 1.0f)
+ return true; // 180 degrees inverted y.
+ }
+ } else if (type == QTransform::TxRotate) {
+ // Check for 90, and 270 degree rotations.
+ qreal m11 = transform.m11();
+ qreal m12 = transform.m12();
+ qreal m21 = transform.m21();
+ qreal m22 = transform.m22();
+ if (m11 == 0.0f && m22 == 0.0f) {
+ if (m12 == 1.0f && m21 == -1.0f)
+ return true; // 90 degrees.
+ else if (m12 == -1.0f && m21 == 1.0f)
+ return true; // 270 degrees.
+ else if (m12 == -1.0f && m21 == -1.0f)
+ return true; // 90 degrees inverted y.
+ else if (m12 == 1.0f && m21 == 1.0f)
+ return true; // 270 degrees inverted y.
+ }
+ }
+ return false;
+}
+
/*!
\internal
@@ -4530,32 +4574,28 @@ void QGraphicsScenePrivate::drawItemHelper(QGraphicsItem *item, QPainter *painte
if (invertable)
diff *= painter->worldTransform();
deviceData->lastTransform = painter->worldTransform();
- if (!invertable
- || diff.type() > QTransform::TxTranslate
- || painter->worldTransform().type() > QTransform::TxScale) {
+ bool allowPartialCacheExposure = false;
+ bool simpleTransform = invertable && diff.type() <= QTransform::TxTranslate
+ && transformIsSimple(painter->worldTransform());
+ if (!simpleTransform) {
pixModified = true;
itemCache->allExposed = true;
itemCache->exposed.clear();
+ deviceData->cacheIndent = QPoint();
pix = QPixmap();
+ } else {
+ allowPartialCacheExposure = deviceData->cacheIndent != QPoint();
}
- // ### This is a pretty bad way to determine when to start partial
- // exposure for DeviceCoordinateCache but it's the least intrusive
- // approach for now.
-#if 0
- // Only if the device rect isn't fully contained.
- bool allowPartialCacheExposure = !viewRect.contains(deviceRect);
-#else
- // Only if deviceRect is 20% taller or wider than the desktop.
- bool allowPartialCacheExposure = false;
- if (widget) {
- QRect desktopRect = QApplication::desktop()->availableGeometry(widget);
- allowPartialCacheExposure = (desktopRect.width() * 1.2 < deviceRect.width()
- || desktopRect.height() * 1.2 < deviceRect.height());
+ // Allow partial cache exposure if the device rect isn't fully contained and
+ // deviceRect is 20% taller or wider than the viewRect.
+ if (!allowPartialCacheExposure && !viewRect.contains(deviceRect)) {
+ allowPartialCacheExposure = (viewRect.width() * 1.2 < deviceRect.width())
+ || (viewRect.height() * 1.2 < deviceRect.height());
}
-#endif
+
QRegion scrollExposure;
- if (deviceData->cacheIndent != QPoint() || allowPartialCacheExposure) {
+ if (allowPartialCacheExposure) {
// Part of pixmap is drawn. Either device contains viewrect (big
// item covers whole screen) or parts of device are outside the
// viewport. In either case the device rect must be the intersect
diff --git a/src/gui/image/qpixmap_x11_p.h b/src/gui/image/qpixmap_x11_p.h
index 821fb69..f171281 100644
--- a/src/gui/image/qpixmap_x11_p.h
+++ b/src/gui/image/qpixmap_x11_p.h
@@ -115,6 +115,7 @@ private:
friend class QEglContext; // Needs gl_surface
friend class QGLContext; // Needs gl_surface
friend class QX11GLPixmapData; // Needs gl_surface
+ friend class QMeeGoGraphicsSystem; // Needs gl_surface and flags
friend bool qt_createEGLSurfaceForPixmap(QPixmapData*, bool); // Needs gl_surface
void release();
diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
index e7f6439..611c962 100644
--- a/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegoextensions.cpp
@@ -46,6 +46,7 @@
bool QMeeGoExtensions::initialized = false;
bool QMeeGoExtensions::hasImageShared = false;
bool QMeeGoExtensions::hasSurfaceScaling = false;
+bool QMeeGoExtensions::hasLockSurface = false;
/* Extension funcs */
@@ -53,11 +54,15 @@ typedef EGLBoolean (EGLAPIENTRY *eglQueryImageNOKFunc)(EGLDisplay, EGLImageKHR,
typedef EGLNativeSharedImageTypeNOK (EGLAPIENTRY *eglCreateSharedImageNOKFunc)(EGLDisplay, EGLImageKHR, EGLint*);
typedef EGLBoolean (EGLAPIENTRY *eglDestroySharedImageNOKFunc)(EGLDisplay, EGLNativeSharedImageTypeNOK);
typedef EGLBoolean (EGLAPIENTRY *eglSetSurfaceScalingNOKFunc)(EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint);
+typedef EGLBoolean (EGLAPIENTRY *eglLockSurfaceKHRFunc)(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+typedef EGLBoolean (EGLAPIENTRY *eglUnlockSurfaceKHRFunc)(EGLDisplay display, EGLSurface surface);
static eglQueryImageNOKFunc _eglQueryImageNOK = 0;
static eglCreateSharedImageNOKFunc _eglCreateSharedImageNOK = 0;
static eglDestroySharedImageNOKFunc _eglDestroySharedImageNOK = 0;
static eglSetSurfaceScalingNOKFunc _eglSetSurfaceScalingNOK = 0;
+static eglLockSurfaceKHRFunc _eglLockSurfaceKHR = 0;
+static eglUnlockSurfaceKHRFunc _eglUnlockSurfaceKHR = 0;
/* Public */
@@ -101,6 +106,22 @@ bool QMeeGoExtensions::eglSetSurfaceScalingNOK(EGLDisplay dpy, EGLSurface surfac
return _eglSetSurfaceScalingNOK(dpy, surface, x, y, width, height);
}
+bool QMeeGoExtensions::eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list)
+{
+ if (! hasLockSurface)
+ qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!");
+
+ return _eglLockSurfaceKHR(display, surface, attrib_list);
+}
+
+bool QMeeGoExtensions::eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface)
+{
+ if (! hasLockSurface)
+ qFatal("EGL_KHR_lock_surface2 not found but trying to use capability!");
+
+ return _eglUnlockSurfaceKHR(display, surface);
+}
+
/* Private */
void QMeeGoExtensions::initialize()
@@ -113,6 +134,8 @@ void QMeeGoExtensions::initialize()
_eglQueryImageNOK = (eglQueryImageNOKFunc) eglGetProcAddress("eglQueryImageNOK");
_eglCreateSharedImageNOK = (eglCreateSharedImageNOKFunc) eglGetProcAddress("eglCreateSharedImageNOK");
_eglDestroySharedImageNOK = (eglDestroySharedImageNOKFunc) eglGetProcAddress("eglDestroySharedImageNOK");
+ _eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR");
+ _eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR");
Q_ASSERT(_eglQueryImageNOK && _eglCreateSharedImageNOK && _eglDestroySharedImageNOK);
hasImageShared = true;
@@ -125,5 +148,14 @@ void QMeeGoExtensions::initialize()
Q_ASSERT(_eglSetSurfaceScalingNOK);
hasSurfaceScaling = true;
}
+
+ if (QEgl::hasExtension("EGL_KHR_lock_surface2")) {
+ qDebug("MeegoGraphics: found EGL_KHR_lock_surface2");
+ _eglLockSurfaceKHR = (eglLockSurfaceKHRFunc) eglGetProcAddress("eglLockSurfaceKHR");
+ _eglUnlockSurfaceKHR = (eglUnlockSurfaceKHRFunc) eglGetProcAddress("eglUnlockSurfaceKHR");
+
+ Q_ASSERT(_eglLockSurfaceKHR && _eglUnlockSurfaceKHR);
+ hasLockSurface = true;
+ }
}
diff --git a/src/plugins/graphicssystems/meego/qmeegoextensions.h b/src/plugins/graphicssystems/meego/qmeegoextensions.h
index ee20bd8..9e78caf 100644
--- a/src/plugins/graphicssystems/meego/qmeegoextensions.h
+++ b/src/plugins/graphicssystems/meego/qmeegoextensions.h
@@ -65,6 +65,18 @@ typedef void* EGLNativeSharedImageTypeNOK;
#define EGL_FIXED_HEIGHT_NOK 0x30DC
#endif
+#ifndef EGL_BITMAP_POINTER_KHR
+#define EGL_BITMAP_POINTER_KHR 0x30C6
+#define EGL_BITMAP_PITCH_KHR 0x30C7
+#endif
+
+#ifndef EGL_MAP_PRESERVE_PIXELS_KHR
+#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
+#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
+#define EGL_READ_SURFACE_BIT_KHR 0x0001
+#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
+#endif
+
/* Class */
class QMeeGoExtensions
@@ -76,6 +88,8 @@ public:
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);
+ static bool eglLockSurfaceKHR(EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
+ static bool eglUnlockSurfaceKHR(EGLDisplay display, EGLSurface surface);
private:
static void initialize();
@@ -83,6 +97,7 @@ private:
static bool initialized;
static bool hasImageShared;
static bool hasSurfaceScaling;
+ static bool hasLockSurface;
};
#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 2a64d49..f8b228c 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -51,6 +51,7 @@
#include <private/qimage_p.h>
#include <private/qeglproperties_p.h>
#include <private/qeglcontext_p.h>
+#include <private/qpixmap_x11_p.h>
#include "qmeegopixmapdata.h"
#include "qmeegographicssystem.h"
@@ -58,6 +59,8 @@
bool QMeeGoGraphicsSystem::surfaceWasCreated = false;
+QHash <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps;
+
QMeeGoGraphicsSystem::QMeeGoGraphicsSystem()
{
qDebug("Using the meego graphics system");
@@ -170,6 +173,22 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(Qt::HANDLE handl
}
}
+QPixmapData *QMeeGoGraphicsSystem::pixmapDataFromEGLImage(Qt::HANDLE handle)
+{
+ if (QMeeGoGraphicsSystem::meeGoRunning()) {
+ QMeeGoPixmapData *pmd = new QMeeGoPixmapData;
+ pmd->fromEGLImage(handle);
+
+ // FIXME Ok. This is a bit BAD BAD BAD. We're abusing here the fact that we KNOW
+ // that this function is used for the live pixmap...
+ pmd->texture()->options &= ~QGLContext::InvertedYBindOption;
+ return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
+ } else {
+ qFatal("Can't create from EGL image when not running meego graphics system!");
+ return NULL;
+ }
+}
+
void QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(QPixmap *pixmap)
{
QMeeGoPixmapData *pmd = (QMeeGoPixmapData *) pixmap->pixmapData();
@@ -188,6 +207,109 @@ QPixmapData *QMeeGoGraphicsSystem::pixmapDataWithGLTexture(int w, int h)
return QMeeGoGraphicsSystem::wrapPixmapData(pmd);
}
+Qt::HANDLE QMeeGoGraphicsSystem::createLiveTexture(int w, int h, QImage::Format format)
+{
+ // No need to wrap the QPixmapData here. This QPixmap(Data) is a
+ // internal implementation and we don't migrate it between
+ // graphics system switching.
+
+ // We use a bit ugly way of enforcing a color format on the X pixmap -- we create
+ // a local QImage and fromImage from there. This is quite redundant (extra overhead of creating
+ // the useless image only to delete it) but shouldn't be too bad for now... you're not expected
+ // to call createLiveTexture too often anyways. Would be great if QX11PixmapData had a way to
+ // force the X format upon creation or resize.
+
+ QImage image(w, h, format);
+ QX11PixmapData *pmd = new QX11PixmapData(QPixmapData::PixmapType);
+ pmd->fromImage(image, Qt::NoOpaqueDetection);
+ QPixmap *p = new QPixmap(pmd);
+
+ liveTexturePixmaps.insert(p->handle(), p);
+ return p->handle();
+}
+
+void QMeeGoGraphicsSystem::destroyLiveTexture(Qt::HANDLE h)
+{
+ if (liveTexturePixmaps.contains(h)) {
+ QPixmap *p = liveTexturePixmaps.value(h);
+ delete p;
+ liveTexturePixmaps.remove(h);
+ } else
+ qWarning("Trying to destroy live texture %ld which was not found!", h);
+}
+
+bool QMeeGoGraphicsSystem::lockLiveTexture(Qt::HANDLE h)
+{
+ if (! liveTexturePixmaps.contains(h)) {
+ qWarning("Trying to lock live texture %ld which was not found!", h);
+ return false;
+ }
+
+ EGLint attribs[] = {
+ EGL_MAP_PRESERVE_PIXELS_KHR, EGL_TRUE,
+ EGL_LOCK_USAGE_HINT_KHR, EGL_READ_SURFACE_BIT_KHR | EGL_WRITE_SURFACE_BIT_KHR,
+ EGL_NONE
+ };
+
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ EGLSurface surface = getSurfaceForLiveTexturePixmap(liveTexturePixmaps.value(h));
+ return QMeeGoExtensions::eglLockSurfaceKHR(QEgl::display(), surface, attribs);
+}
+
+bool QMeeGoGraphicsSystem::unlockLiveTexture(Qt::HANDLE h)
+{
+ if (! liveTexturePixmaps.contains(h)) {
+ qWarning("Trying to lock live texture %ld which was not found!", h);
+ return false;
+ }
+
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QMeeGoExtensions::ensureInitialized();
+
+ EGLSurface surface = getSurfaceForLiveTexturePixmap(liveTexturePixmaps.value(h));
+ if (QMeeGoExtensions::eglUnlockSurfaceKHR(QEgl::display(), surface)) {
+ glFinish();
+ return true;
+ } else {
+ return false;
+ }
+}
+
+void QMeeGoGraphicsSystem::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch)
+{
+ // FIXME Only allow this on locked surfaces
+ if (! liveTexturePixmaps.contains(h)) {
+ qWarning("Trying to query live texture %ld which was not found!", h);
+ return;
+ }
+
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QMeeGoExtensions::ensureInitialized();
+
+ EGLSurface surface = getSurfaceForLiveTexturePixmap(liveTexturePixmaps.value(h));
+ eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_POINTER_KHR, (EGLint*) data);
+ eglQuerySurface(QEgl::display(), surface, EGL_BITMAP_PITCH_KHR, (EGLint*) pitch);
+}
+
+Qt::HANDLE QMeeGoGraphicsSystem::liveTextureToEGLImage(Qt::HANDLE h)
+{
+ QGLShareContextScope ctx(qt_gl_share_widget()->context());
+ QMeeGoExtensions::ensureInitialized();
+
+ EGLint attribs[] = {
+ EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
+ EGL_NONE
+ };
+
+ EGLImageKHR eglImage = QEgl::eglCreateImageKHR(QEgl::display(), EGL_NO_CONTEXT, EGL_NATIVE_PIXMAP_KHR,
+ (EGLClientBuffer) h, attribs);
+
+ if (eglImage == EGL_NO_IMAGE_KHR)
+ qWarning("eglCreateImageKHR failed!");
+
+ return (Qt::HANDLE) eglImage;
+}
+
bool QMeeGoGraphicsSystem::meeGoRunning()
{
if (! QApplicationPrivate::instance()) {
@@ -204,6 +326,52 @@ bool QMeeGoGraphicsSystem::meeGoRunning()
return (name == "meego");
}
+void QMeeGoGraphicsSystem::destroySurfaceForLiveTexturePixmap(QPixmapData* pmd)
+{
+ Q_ASSERT(pmd->classId() == QPixmapData::X11Class);
+ QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pmd);
+ if (pixmapData->gl_surface) {
+ eglDestroySurface(QEgl::display(), (EGLSurface)pixmapData->gl_surface);
+ pixmapData->gl_surface = 0;
+ }
+}
+
+EGLSurface QMeeGoGraphicsSystem::getSurfaceForLiveTexturePixmap(QPixmap *pixmap)
+{
+ // This code is a crative remix of the stuff that can be found in the
+ // Qt's TFP implementation in /src/opengl/qgl_x11egl.cpp ::bindiTextureFromNativePixmap
+ QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data());
+ Q_ASSERT(pixmapData->classId() == QPixmapData::X11Class);
+ bool hasAlpha = pixmapData->hasAlphaChannel();
+
+ if (pixmapData->gl_surface &&
+ hasAlpha == (pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha))
+ return pixmapData->gl_surface;
+
+ // Check to see if the surface is still valid
+ if (pixmapData->gl_surface &&
+ hasAlpha != ((pixmapData->flags & QX11PixmapData::GlSurfaceCreatedWithAlpha) > 0)) {
+ // Surface is invalid!
+ QMeeGoGraphicsSystem::destroySurfaceForLiveTexturePixmap(pixmapData);
+ }
+
+ if (pixmapData->gl_surface == 0) {
+ EGLConfig config = QEgl::defaultConfig(QInternal::Pixmap,
+ QEgl::OpenGL,
+ hasAlpha ? QEgl::Translucent : QEgl::NoOptions);
+
+ pixmapData->gl_surface = (void*)QEgl::createSurface(pixmap, config);
+
+ if (hasAlpha)
+ pixmapData->flags = pixmapData->flags | QX11PixmapData::GlSurfaceCreatedWithAlpha;
+
+ if (pixmapData->gl_surface == (void*)EGL_NO_SURFACE)
+ return NULL;
+ }
+
+ return pixmapData->gl_surface;
+}
+
/* C API */
int qt_meego_image_to_egl_shared_image(const QImage &image)
@@ -216,6 +384,11 @@ QPixmapData* qt_meego_pixmapdata_from_egl_shared_image(Qt::HANDLE handle, const
return QMeeGoGraphicsSystem::pixmapDataFromEGLSharedImage(handle, softImage);
}
+QPixmapData* qt_meego_pixmapdata_from_egl_image(Qt::HANDLE handle)
+{
+ return QMeeGoGraphicsSystem::pixmapDataFromEGLImage(handle);
+}
+
QPixmapData* qt_meego_pixmapdata_with_gl_texture(int w, int h)
{
return QMeeGoGraphicsSystem::pixmapDataWithGLTexture(w, h);
@@ -245,3 +418,33 @@ void qt_meego_update_egl_shared_image_pixmap(QPixmap *pixmap)
{
QMeeGoGraphicsSystem::updateEGLSharedImagePixmap(pixmap);
}
+
+Qt::HANDLE qt_meego_live_texture_create(int w, int h, QImage::Format format)
+{
+ return QMeeGoGraphicsSystem::createLiveTexture(w, h, format);
+}
+
+void qt_meego_live_texture_destroy(Qt::HANDLE h)
+{
+ QMeeGoGraphicsSystem::destroyLiveTexture(h);
+}
+
+bool qt_meego_live_texture_lock(Qt::HANDLE h)
+{
+ return QMeeGoGraphicsSystem::lockLiveTexture(h);
+}
+
+bool qt_meego_live_texture_unlock(Qt::HANDLE h)
+{
+ return QMeeGoGraphicsSystem::unlockLiveTexture(h);
+}
+
+void qt_meego_live_texture_query(Qt::HANDLE h, void **data, int *pitch)
+{
+ return QMeeGoGraphicsSystem::queryLiveTexture(h, data, pitch);
+}
+
+Qt::HANDLE qt_meego_live_texture_to_egl_image(Qt::HANDLE h)
+{
+ return QMeeGoGraphicsSystem::liveTextureToEGLImage(h);
+}
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
index 905f0c3..934d32d 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
@@ -43,6 +43,9 @@
#define MGRAPHICSSYSTEM_H
#include <private/qgraphicssystem_p.h>
+#include <EGL/egl.h>
+#include <GLES2/gl2.h>
+#include <GLES2/gl2ext.h>
class QMeeGoGraphicsSystem : public QGraphicsSystem
{
@@ -60,13 +63,24 @@ public:
static void setTranslucent(bool translucent);
static QPixmapData *pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+ static QPixmapData *pixmapDataFromEGLImage(Qt::HANDLE handle);
static QPixmapData *pixmapDataWithGLTexture(int w, int h);
static void updateEGLSharedImagePixmap(QPixmap *pixmap);
+ static Qt::HANDLE createLiveTexture(int w, int h, QImage::Format format);
+ static void destroyLiveTexture(Qt::HANDLE h);
+ static bool lockLiveTexture(Qt::HANDLE h);
+ static bool unlockLiveTexture(Qt::HANDLE h);
+ static void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch);
+ static Qt::HANDLE liveTextureToEGLImage(Qt::HANDLE h);
+
private:
static bool meeGoRunning();
+ static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap);
+ static void destroySurfaceForLiveTexturePixmap(QPixmapData* pmd);
static bool surfaceWasCreated;
+ static QHash <Qt::HANDLE, QPixmap*> liveTexturePixmaps;
};
/* C api */
@@ -74,12 +88,19 @@ private:
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_from_egl_image(Qt::HANDLE handle);
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);
+ Q_DECL_EXPORT Qt::HANDLE m_live_texture_create(int w, int h, QImage::Format format);
+ Q_DECL_EXPORT void m_live_texture_destroy(Qt::HANDLE h);
+ Q_DECL_EXPORT bool m_live_texture_lock(Qt::HANDLE h);
+ Q_DECL_EXPORT bool m_live_texture_unlock(Qt::HANDLE h);
+ Q_DECL_EXPORT void m_live_texture_query(Qt::HANDLE h, void **data, int *pitch);
+ Q_DECL_EXPORT Qt::HANDLE m_live_texture_to_egl_image(Qt::HANDLE h);
}
#endif
diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
index 33611dc..84fc593 100644
--- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.cpp
@@ -87,6 +87,36 @@ void QMeeGoPixmapData::fromImage(const QImage &image,
}
}
+void QMeeGoPixmapData::fromEGLImage(Qt::HANDLE handle)
+{
+ 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);
+
+ glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (EGLImageKHR) handle);
+ GLint err = glGetError();
+ if (err == GL_NO_ERROR)
+ textureIsBound = true;
+
+ QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), (EGLImageKHR) handle, EGL_WIDTH, &newWidth);
+ QMeeGoExtensions::eglQueryImageNOK(QEgl::display(), (EGLImageKHR) handle, EGL_HEIGHT, &newHeight);
+
+ if (textureIsBound) {
+ // FIXME Remove this ugly hasAlphaChannel check when Qt lands the NoOpaqueCheck flag fix
+ // for QGLPixmapData.
+ fromTexture(newTextureId, newWidth, newHeight, true);
+ } else {
+ qWarning("Failed to create a texture from an egl image!");
+ glDeleteTextures(1, &newTextureId);
+ }
+}
+
void QMeeGoPixmapData::fromEGLSharedImage(Qt::HANDLE handle, const QImage &si)
{
if (si.isNull())
diff --git a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h b/src/plugins/graphicssystems/meego/qmeegopixmapdata.h
index 8af33bd..8b1ae14 100644
--- a/src/plugins/graphicssystems/meego/qmeegopixmapdata.h
+++ b/src/plugins/graphicssystems/meego/qmeegopixmapdata.h
@@ -56,6 +56,7 @@ public:
QMeeGoPixmapData();
void fromTexture(GLuint textureId, int w, int h, bool alpha);
+ virtual void fromEGLImage(Qt::HANDLE handle);
virtual void fromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
virtual void fromImage (const QImage &image, Qt::ImageConversionFlags flags);
virtual QImage toImage() const;
diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
index 25ec040..2901dd5 100644
--- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
+++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp
@@ -445,6 +445,7 @@ private slots:
void textItem_shortcuts();
void scroll();
void stopClickFocusPropagation();
+ void deviceCoordinateCache_simpleRotations();
// task specific tests below me
void task141694_textItemEnsureVisible();
@@ -10560,6 +10561,81 @@ void tst_QGraphicsItem::stopClickFocusPropagation()
QVERIFY(itemWithFocus->hasFocus());
}
+void tst_QGraphicsItem::deviceCoordinateCache_simpleRotations()
+{
+ // Make sure we don't invalidate the cache when applying simple
+ // (90, 180, 270, 360) rotation transforms to the item.
+ QGraphicsRectItem *item = new QGraphicsRectItem(0, 0, 300, 200);
+ item->setBrush(Qt::red);
+ item->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
+
+ QGraphicsScene scene;
+ scene.setSceneRect(0, 0, 300, 200);
+ scene.addItem(item);
+
+ MyGraphicsView view(&scene);
+ view.show();
+ QTest::qWaitForWindowShown(&view);
+ QTRY_VERIFY(view.repaints > 0);
+
+ QGraphicsItemCache *itemCache = QGraphicsItemPrivate::get(item)->extraItemCache();
+ Q_ASSERT(itemCache);
+ QPixmapCache::Key currentKey = itemCache->deviceData.value(view.viewport()).key;
+
+ // Trigger an update and verify that the cache is unchanged.
+ QPixmapCache::Key oldKey = currentKey;
+ view.reset();
+ view.viewport()->update();
+ QTRY_VERIFY(view.repaints > 0);
+ currentKey = itemCache->deviceData.value(view.viewport()).key;
+ QCOMPARE(currentKey, oldKey);
+
+ // Check 90, 180, 270 and 360 degree rotations.
+ for (int angle = 90; angle <= 360; angle += 90) {
+ // Rotate item and verify that the cache was invalidated.
+ oldKey = currentKey;
+ view.reset();
+ QTransform transform;
+ transform.translate(150, 100);
+ transform.rotate(angle);
+ transform.translate(-150, -100);
+ item->setTransform(transform);
+ QTRY_VERIFY(view.repaints > 0);
+ currentKey = itemCache->deviceData.value(view.viewport()).key;
+ QVERIFY(currentKey != oldKey);
+
+ // IMPORTANT PART:
+ // Trigger an update and verify that the cache is unchanged.
+ oldKey = currentKey;
+ view.reset();
+ view.viewport()->update();
+ QTRY_VERIFY(view.repaints > 0);
+ currentKey = itemCache->deviceData.value(view.viewport()).key;
+ QCOMPARE(currentKey, oldKey);
+ }
+
+ // 45 degree rotation.
+ oldKey = currentKey;
+ view.reset();
+ QTransform transform;
+ transform.translate(150, 100);
+ transform.rotate(45);
+ transform.translate(-150, -100);
+ item->setTransform(transform);
+ QTRY_VERIFY(view.repaints > 0);
+ currentKey = itemCache->deviceData.value(view.viewport()).key;
+ QVERIFY(currentKey != oldKey);
+
+ // Trigger an update and verify that the cache was invalidated.
+ // We should always invalidate the cache for non-trivial transforms.
+ oldKey = currentKey;
+ view.reset();
+ view.viewport()->update();
+ QTRY_VERIFY(view.repaints > 0);
+ currentKey = itemCache->deviceData.value(view.viewport()).key;
+ QVERIFY(currentKey != oldKey);
+}
+
void tst_QGraphicsItem::QTBUG_5418_textItemSetDefaultColor()
{
struct Item : public QGraphicsTextItem
diff --git a/tools/designer/src/plugins/plugins.pro b/tools/designer/src/plugins/plugins.pro
index cf4fa8a..bcebb82 100644
--- a/tools/designer/src/plugins/plugins.pro
+++ b/tools/designer/src/plugins/plugins.pro
@@ -3,7 +3,7 @@ CONFIG += ordered
REQUIRES = !CONFIG(static,shared|static)
contains(QT_CONFIG, qt3support): SUBDIRS += widgets
-win32:!contains(QT_EDITION, OpenSource):SUBDIRS += activeqt
+win32: SUBDIRS += activeqt
# contains(QT_CONFIG, opengl): SUBDIRS += tools/view3d
contains(QT_CONFIG, webkit): SUBDIRS += qwebview
contains(QT_CONFIG, phonon): SUBDIRS += phononwidgets
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
index 0670ac4..d348e70 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
@@ -68,6 +68,11 @@ bool QMeeGoGraphicsSystemHelper::isRunningMeeGo()
return (runningGraphicsSystemName() == QLatin1String("meego"));
}
+bool QMeeGoGraphicsSystemHelper::isRunningRuntime()
+{
+ return (QApplicationPrivate::instance()->graphics_system_name == QLatin1String("runtime"));
+}
+
void QMeeGoGraphicsSystemHelper::switchToMeeGo()
{
if (isRunningMeeGo())
@@ -105,13 +110,13 @@ QPixmap QMeeGoGraphicsSystemHelper::pixmapFromEGLSharedImage(Qt::HANDLE handle,
// This function is supported when not running meego too. A raster-backed
// pixmap will be created... but when you switch back to 'meego', it'll
// be replaced with a EGL shared image backing.
- return QMeeGoRuntime::pixmapFromEGLSharedImage(handle, softImage);
+ return QPixmap(QMeeGoRuntime::pixmapDataFromEGLSharedImage(handle, softImage));
}
QPixmap QMeeGoGraphicsSystemHelper::pixmapWithGLTexture(int w, int h)
{
ENSURE_RUNNING_MEEGO;
- return QMeeGoRuntime::pixmapWithGLTexture(w, h);
+ return QPixmap(QMeeGoRuntime::pixmapDataWithGLTexture(w, h));
}
bool QMeeGoGraphicsSystemHelper::destroyEGLSharedImage(Qt::HANDLE handle)
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
index 02f2fa2..2bb75eb 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
@@ -89,6 +89,13 @@ public:
switching is 'meego'.
*/
static bool isRunningMeeGo();
+
+ //! Returns true if running with a 'runtime' graphicssystem.
+ /*!
+ This function can be used in combination with ::runningGraphicsSystemName to figure out
+ the existing situation.
+ */
+ static bool isRunningRuntime();
//! Switches to meego graphics system.
/*!
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
index 1e6e233..4d69fac 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
@@ -6,5 +6,5 @@ include(../../src/qbase.pri)
QT += gui
INCLUDEPATH += '../../src/plugins/graphicssystems/meego'
-HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoliveimage.h qmeegoruntime.h qmeegoliveimage_p.h qmeegolivepixmap_p.h
-SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegoliveimage.cpp
+HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h
+SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp
diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp b/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp
deleted file mode 100644
index 83a1e28..0000000
--- a/tools/qmeegographicssystemhelper/qmeegoliveimage.cpp
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** 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 "qmeegoliveimage.h"
-#include "qmeegoliveimage_p.h"
-#include "qmeegolivepixmap.h"
-#include "qmeegolivepixmap_p.h"
-
-/* QMeeGoLiveImagePrivate */
-
-QMeeGoLiveImagePrivate::QMeeGoLiveImagePrivate()
-{
-}
-
-QMeeGoLiveImagePrivate::~QMeeGoLiveImagePrivate()
-{
- if (attachedPixmaps.length() > 0)
- qWarning("Destroying QMeeGoLiveImage but it still has QMeeGoLivePixmaps attached!");
-}
-
-void QMeeGoLiveImagePrivate::attachPixmap(QMeeGoLivePixmap* pixmap)
-{
- attachedPixmaps << pixmap;
-}
-
-void QMeeGoLiveImagePrivate::detachPixmap(QMeeGoLivePixmap* pixmap)
-{
- attachedPixmaps.removeAll(pixmap);
-}
-
-/* QMeeGoLiveImage */
-
-QMeeGoLiveImage* QMeeGoLiveImage::liveImageWithSize(int w, int h, Format format, int buffers)
-{
- if (format != Format_ARGB32_Premultiplied) {
- qWarning("Only _ARGB32_Premultiplied format is supported for live images now!");
- return 0;
- }
-
- if (buffers != 1) {
- qWarning("Only single-buffer streams are supported at the moment");
- return 0;
- }
-
- QMeeGoLiveImage *liveImage = new QMeeGoLiveImage(w, h);
- return liveImage;
-}
-
-QMeeGoLiveImage::QMeeGoLiveImage(int w, int h) : QImage(w, h, QImage::Format_ARGB32_Premultiplied), d_ptr(new QMeeGoLiveImagePrivate())
-{
- Q_D(QMeeGoLiveImage);
- d->q_ptr = this;
-}
-
-QMeeGoLiveImage::~QMeeGoLiveImage()
-{
-}
-
-void QMeeGoLiveImage::lock(int buffer)
-{
- if (buffer != 0)
- qWarning("Only locking 0 buffer is supported at the moment!");
-}
-
-void QMeeGoLiveImage::release(int buffer)
-{
- Q_D(QMeeGoLiveImage);
-
- if (buffer != 0) {
- qWarning("Only locking 0 buffer is supported at the moment!");
- return;
- }
-
- // We need to copy the update image to all the client QMeeGoLivePixmap's
- foreach (QMeeGoLivePixmap* livePixmap, d->attachedPixmaps)
- livePixmap->d_ptr->copyBackFrom((const void *) bits());
-}
diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage.h b/tools/qmeegographicssystemhelper/qmeegoliveimage.h
deleted file mode 100644
index 1e21e7b..0000000
--- a/tools/qmeegographicssystemhelper/qmeegoliveimage.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** 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 QMEEGOLIVEIMAGE_H
-#define QMEEGOLIVEIMAGE_H
-
-#include <QImage>
-
-class QMeeGoLivePixmap;
-class QMeeGoLiveImagePrivate;
-
-//! A streamable QImage subclass.
-/*!
-*/
-
-class QMeeGoLiveImage : public QImage
-{
-public:
- //! Format specifier.
- /*!
- Used to specify the format of the underlying image data for QMeeGoLiveImage.
- */
- enum Format {
- Format_ARGB32_Premultiplied //! 32bit, AARRGGBB format. The typical Qt format.
- };
-
- //! Locks the access to the image.
- /*!
- All drawing/access to the underlying image data needs to happen between
- ::lock() and ::unlock() pairs.
- */
- void lock(int buffer = 0);
-
- //! Unlocks the access to the image.
- /*!
- All drawing/access to the underlying image data needs to happen between
- ::lock() and ::unlock() pairs.
- */
- void release(int buffer = 0);
-
- //! Destroys the image.
- /*!
- It's a mistake to destroy an image before destroying all the QMeeGoLivePixmaps
- built on top of it. You should first destroy all the QMeeGoLivePixmaps.
- */
- virtual ~QMeeGoLiveImage();
-
- //! Creates and returns a new live image with the given parameters.
- /*!
- The new image is created with the given width w and the given height h.
- The format specifies the color format used by the image. Optionally, a
- number of buffers can be specfied for a stream-like behavior.
- */
- static QMeeGoLiveImage* liveImageWithSize(int w, int h, Format format, int buffers = 1);
-
-private:
- QMeeGoLiveImage(int w, int h); //! Private bits.
- Q_DISABLE_COPY(QMeeGoLiveImage)
- Q_DECLARE_PRIVATE(QMeeGoLiveImage)
-
-protected:
- QScopedPointer<QMeeGoLiveImagePrivate> d_ptr;
-
- friend class QMeeGoLivePixmap;
- friend class QMeeGoLivePixmapPrivate;
-};
-
-#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h b/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h
deleted file mode 100644
index 085fed4..0000000
--- a/tools/qmeegographicssystemhelper/qmeegoliveimage_p.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** 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 "qmeegoliveimage.h"
-
-#ifndef QMEEGOLIVEIMAGE_P_H
-#define QMEEGOLIVEIMAGE_P_H
-
-class QMeeGoLiveImagePrivate
-{
-public:
- Q_DECLARE_PUBLIC(QMeeGoLiveImage);
- QMeeGoLiveImagePrivate();
- virtual ~QMeeGoLiveImagePrivate();
- void attachPixmap(QMeeGoLivePixmap* pixmap);
- void detachPixmap(QMeeGoLivePixmap* pixmap);
-
- QList <QMeeGoLivePixmap*> attachedPixmaps;
- QMeeGoLiveImage *q_ptr;
-
- friend class QMeeGoLivePixmap;
- friend class QMeeGoLivePixmapPrivate;
-};
-
-#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
index 2a1c04b..b9dbb2b 100644
--- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
@@ -43,121 +43,101 @@
#include <private/qimage_p.h>
#include <private/qpixmap_raster_p.h>
#include "qmeegolivepixmap_p.h"
-#include "qmeegoliveimage_p.h"
+#include "qmeegoruntime.h"
#include <QSharedMemory>
/* QMeeGoLivePixmapPrivate */
-QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate() : shm(0), shmSerial(0), owns(true), parentImage(0)
+QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate(Qt::HANDLE h) : handle(h)
{
}
-void QMeeGoLivePixmapPrivate::copyBackFrom(const void *raw)
+QMeeGoLivePixmapPrivate::~QMeeGoLivePixmapPrivate()
{
- Q_Q(QMeeGoLivePixmap);
-
- q->detach();
- shm->lock();
- uchar *dest = ((uchar *) shm->data()) + (2 * sizeof(int));
- memcpy(dest, raw, q->width() * q->height() * 4);
- shm->unlock();
}
-QMeeGoLivePixmapPrivate::~QMeeGoLivePixmapPrivate()
+/* QMeeGoLivePixmap */
+
+QMeeGoLivePixmap* QMeeGoLivePixmap::livePixmapWithSize(int w, int h, Format format)
{
- Q_Q(QMeeGoLivePixmap);
+ QImage::Format qtFormat;
+ if (format == Format_RGB16)
+ qtFormat = QImage::Format_RGB16;
+ else if (format == Format_ARGB32_Premultiplied)
+ qtFormat = QImage::Format_ARGB32_Premultiplied;
+ else {
+ qWarning("Unsupported live pixmap format!");
+ return 0;
+ }
- if (parentImage)
- parentImage->d_ptr->detachPixmap(q);
-
- if (shm)
- shm->detach();
-
- if (owns)
- delete shm;
-}
+ Qt::HANDLE liveTextureHandle = QMeeGoRuntime::createLiveTexture(w, h, qtFormat);
+ if (! liveTextureHandle) {
+ qWarning("Failed to create a live texture with given size!");
+ return NULL;
+ }
-/* QMeeGoLivePixmap */
+ return QMeeGoLivePixmap::fromHandle(liveTextureHandle);
+}
-QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate())
+QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p, Qt::HANDLE h) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate(h))
{
Q_D(QMeeGoLivePixmap);
d->q_ptr = this;
}
-QMeeGoLivePixmap* QMeeGoLivePixmap::fromLiveImage(QMeeGoLiveImage *liveImage)
+QMeeGoLivePixmap* QMeeGoLivePixmap::fromHandle(Qt::HANDLE liveTextureHandle)
{
- static int counter = 100;
- QSharedMemory *shm = NULL;
- uchar* imgData = NULL;
- int *header = NULL;
- int w = liveImage->width();
- int h = liveImage->height();
-
- counter++;
- shm = new QSharedMemory(QString(QLatin1String("QMeeGoLivePixmap%1")).arg(counter));
- shm->create((w * h * 4) + 2 * sizeof(int)); // +2 to store width & height
- shm->attach();
-
- imgData = ((uchar *) shm->data()) + (2 * sizeof(int));
- header = (int *) shm->data();
-
- header[0] = w;
- header[1] = h;
-
- QImage img(imgData, w, h, QImage::Format_ARGB32_Premultiplied);
-
- QPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType);
- pmd->fromImage(img, Qt::NoOpaqueDetection);
-
- QMeeGoLivePixmap *livePixmap = new QMeeGoLivePixmap(pmd);
- livePixmap->d_ptr->shm = shm;
- livePixmap->d_ptr->owns = true;
- livePixmap->d_ptr->shmSerial = counter;
- livePixmap->d_ptr->parentImage = liveImage;
-
- liveImage->d_ptr->attachPixmap(livePixmap);
+ Qt::HANDLE eglImage = QMeeGoRuntime::liveTextureToEGLImage(liveTextureHandle);
+ if (! eglImage) {
+ qWarning("Failed to bind the live texture as an egl image!");
+ return NULL;
+ }
- return livePixmap;
+ QPixmapData *pmd = QMeeGoRuntime::pixmapDataFromEGLImage(eglImage);
+ if (! pmd) {
+ qWarning("Failed to allocate a pixmap data from a given live texture egl image!");
+ return NULL;
+ }
+
+ return new QMeeGoLivePixmap(pmd, liveTextureHandle);
}
-QMeeGoLivePixmap* QMeeGoLivePixmap::fromHandle(Qt::HANDLE handle)
+Qt::HANDLE QMeeGoLivePixmap::handle()
{
- QSharedMemory *shm = NULL;
- int *header;
- int width;
- int height;
- uchar* imgData;
-
- shm = new QSharedMemory(QString(QLatin1String("QMeeGoLivePixmap%1")).arg(handle));
- shm->attach();
-
- shm->lock();
- header = (int *) shm->data();
- width = header[0];
- height = header[1];
- shm->unlock();
-
- imgData = ((uchar *) shm->data()) + (2 * sizeof(int));
- QImage img(imgData, width, height, QImage::Format_ARGB32_Premultiplied);
-
- QPixmapData *pmd = new QRasterPixmapData(QPixmapData::PixmapType);
- pmd->fromImage(img, Qt::NoOpaqueDetection);
-
- QMeeGoLivePixmap *livePixmap = new QMeeGoLivePixmap(pmd);
- livePixmap->d_ptr->shm = shm;
- livePixmap->d_ptr->owns = false;
- livePixmap->d_ptr->shmSerial = handle;
-
- return livePixmap;
+ Q_D(QMeeGoLivePixmap);
+ return d->handle;
}
QMeeGoLivePixmap::~QMeeGoLivePixmap()
{
}
-Qt::HANDLE QMeeGoLivePixmap::handle()
+QImage* QMeeGoLivePixmap::lock()
+{
+ Q_D(QMeeGoLivePixmap);
+
+ void *data = NULL;
+ int pitch = 0;
+
+ if (! QMeeGoRuntime::lockLiveTexture(d->handle)) {
+ qWarning("Failed to lock a live texture!");
+ return new QImage();
+ }
+
+ QMeeGoRuntime::queryLiveTexture(d->handle, &data, &pitch);
+ if (data == NULL || pitch == 0) {
+ qWarning("Failed to query the live texture!");
+ return new QImage();
+ }
+
+ // FIXME Bug here! FIX FIX FIX FIX FIX FIX
+ return new QImage((uchar *) data, width(), height(), QImage::Format_RGB16);
+}
+
+void QMeeGoLivePixmap::release(QImage *img)
{
Q_D(QMeeGoLivePixmap);
- return d->shmSerial;
+ // FIXME Make sure we're locked!
+ QMeeGoRuntime::unlockLiveTexture(d->handle);
+ delete img;
}
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
index 2fa9db2..12fe994 100644
--- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.h
@@ -43,7 +43,6 @@
#define QMEEGOLIVEPIXMAP_H
#include <QPixmap>
-#include "qmeegoliveimage.h"
class QMeeGoLivePixmapPrivate;
class QSharedMemory;
@@ -56,13 +55,17 @@ class QImage;
class QMeeGoLivePixmap : public QPixmap
{
public:
- //! Creates new pixmap from the given QMeeGoLiveImage.
- /*!
- The created QMeeGoLivePixmap will be attached to the given QMeeGoLiveImage.
- Updates to the QMeeGoLiveImage will be represented on this newly created
- QMeeGoLivePixmap.
+ enum Format {
+ Format_RGB16, //! 16bit, 5-6-5 RGB format.
+ Format_ARGB32_Premultiplied //! 32bit, AARRGGBB format. The typical Qt format.
+ };
+
+ //! Creates and returns a new live pixmap with the given parameters.
+ /*!
+ The new pixmap is created with the given width w and the given height h.
+ The format specifies the color format used by the pixmap.
*/
- static QMeeGoLivePixmap* fromLiveImage(QMeeGoLiveImage *liveImage);
+ static QMeeGoLivePixmap* livePixmapWithSize(int w, int h, Format format);
//! Creates a new QMeeGoLivePixmap from the specified handle.
/*!
@@ -75,24 +78,30 @@ public:
The handle can be used to share QMeeGoLivePixmap cross-process.
*/
Qt::HANDLE handle();
+
+ //! Locks the access to the pixmap.
+ /*!
+ The returned image can be used for direct access.
+ */
+ QImage* lock();
+
+ //! Unlocks the access to the pixmap.
+ /*!
+ */
+ void release(QImage *img);
//! Destroys the QMeeGoLivePixmap.
/*!
- All QMeeGoLivePixmaps attached to a given QMeeGoLiveImage have to be destroyed
- before the QMeeGoLiveImage itself is destroyed.
*/
virtual ~QMeeGoLivePixmap();
private:
- QMeeGoLivePixmap(QPixmapData *p);
+ QMeeGoLivePixmap(QPixmapData *p, Qt::HANDLE h);
Q_DISABLE_COPY(QMeeGoLivePixmap)
Q_DECLARE_PRIVATE(QMeeGoLivePixmap)
protected:
QScopedPointer<QMeeGoLivePixmapPrivate> d_ptr; //! Private bits.
-
- friend class QMeeGoLiveImage;
- friend class QMeeGoLiveImagePrivate;
};
#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h b/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
index c2591dc..22347d6 100644
--- a/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap_p.h
@@ -48,19 +48,12 @@ class QMeeGoLivePixmapPrivate
{
public:
Q_DECLARE_PUBLIC(QMeeGoLivePixmap);
- QMeeGoLivePixmapPrivate();
- void copyBackFrom(const void *raw);
+ QMeeGoLivePixmapPrivate(Qt::HANDLE handle);
virtual ~QMeeGoLivePixmapPrivate();
- QSharedMemory *shm;
- int shmSerial;
- bool owns;
- QMeeGoLiveImage *parentImage;
+ Qt::HANDLE handle;
QMeeGoLivePixmap *q_ptr;
-
- friend class QMeeGoLiveImage;
- friend class QMeeGoLiveImagePrivate;
};
#endif
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
index 70b5dc1..44f9f58 100644
--- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
@@ -51,21 +51,36 @@ bool QMeeGoRuntime::initialized = false;
typedef int (*QMeeGoImageToEglSharedImageFunc) (const QImage&);
typedef QPixmapData* (*QMeeGoPixmapDataFromEglSharedImageFunc) (Qt::HANDLE handle, const QImage&);
+typedef QPixmapData* (*QMeeGoPixmapDataFromEglImageFunc) (Qt::HANDLE handle);
typedef QPixmapData* (*QMeeGoPixmapDataWithGLTextureFunc) (int w, int h);
typedef bool (*QMeeGoDestroyEGLSharedImageFunc) (Qt::HANDLE handle);
typedef void (*QMeeGoUpdateEglSharedImagePixmapFunc) (QPixmap*);
typedef void (*QMeeGoSetSurfaceFixedSizeFunc) (int w, int h);
typedef void (*QMeeGoSetSurfaceScalingFunc) (int x, int y, int w, int h);
typedef void (*QMeeGoSetTranslucentFunc) (bool translucent);
+typedef Qt::HANDLE (*QMeeGoLiveTextureCreateFunc) (int w, int h, QImage::Format format);
+typedef bool (*QMeeGoLiveTextureLockFunc) (Qt::HANDLE h);
+typedef bool (*QMeeGoLiveTextureUnlockFunc) (Qt::HANDLE h);
+typedef void (*QMeeGoLiveTextureDestroyFunc) (Qt::HANDLE h);
+typedef void (*QMeeGoLiveTextureQueryFunc) (Qt::HANDLE h, void **data, int *pitch);
+typedef Qt::HANDLE (*QMeeGoLiveTextureToEglImageFunc) (Qt::HANDLE h);
static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL;
static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL;
+static QMeeGoPixmapDataFromEglImageFunc qt_meego_pixmapdata_from_egl_image = NULL;
static QMeeGoPixmapDataWithGLTextureFunc qt_meego_pixmapdata_with_gl_texture = NULL;
static QMeeGoDestroyEGLSharedImageFunc qt_meego_destroy_egl_shared_image = NULL;
static QMeeGoUpdateEglSharedImagePixmapFunc qt_meego_update_egl_shared_image_pixmap = NULL;
static QMeeGoSetSurfaceFixedSizeFunc qt_meego_set_surface_fixed_size = NULL;
static QMeeGoSetSurfaceScalingFunc qt_meego_set_surface_scaling = NULL;
static QMeeGoSetTranslucentFunc qt_meego_set_translucent = NULL;
+static QMeeGoLiveTextureCreateFunc qt_meego_live_texture_create = NULL;
+static QMeeGoLiveTextureLockFunc qt_meego_live_texture_lock = NULL;
+static QMeeGoLiveTextureUnlockFunc qt_meego_live_texture_unlock = NULL;
+static QMeeGoLiveTextureDestroyFunc qt_meego_live_texture_destroy = NULL;
+static QMeeGoLiveTextureQueryFunc qt_meego_live_texture_query = NULL;
+static QMeeGoLiveTextureToEglImageFunc qt_meego_live_texture_to_egl_image = NULL;
+
void QMeeGoRuntime::initialize()
{
@@ -80,17 +95,26 @@ void QMeeGoRuntime::initialize()
if (success) {
qt_meego_image_to_egl_shared_image = (QMeeGoImageToEglSharedImageFunc) library.resolve("qt_meego_image_to_egl_shared_image");
- qt_meego_pixmapdata_from_egl_shared_image = (QMeeGoPixmapDataFromEglSharedImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_shared_image");
+ qt_meego_pixmapdata_from_egl_shared_image = (QMeeGoPixmapDataFromEglSharedImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_shared_image");
+ qt_meego_pixmapdata_from_egl_image = (QMeeGoPixmapDataFromEglImageFunc) library.resolve("qt_meego_pixmapdata_from_egl_image");
qt_meego_pixmapdata_with_gl_texture = (QMeeGoPixmapDataWithGLTextureFunc) library.resolve("qt_meego_pixmapdata_with_gl_texture");
qt_meego_destroy_egl_shared_image = (QMeeGoDestroyEGLSharedImageFunc) library.resolve("qt_meego_destroy_egl_shared_image");
qt_meego_update_egl_shared_image_pixmap = (QMeeGoUpdateEglSharedImagePixmapFunc) library.resolve("qt_meego_update_egl_shared_image_pixmap");
qt_meego_set_surface_fixed_size = (QMeeGoSetSurfaceFixedSizeFunc) library.resolve("qt_meego_set_surface_fixed_size");
qt_meego_set_surface_scaling = (QMeeGoSetSurfaceScalingFunc) library.resolve("qt_meego_set_surface_scaling");
qt_meego_set_translucent = (QMeeGoSetTranslucentFunc) library.resolve("qt_meego_set_translucent");
-
- if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && qt_meego_pixmapdata_with_gl_texture
- && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap && qt_meego_set_surface_fixed_size
- && qt_meego_set_surface_scaling && qt_meego_set_translucent)
+ qt_meego_live_texture_create = (QMeeGoLiveTextureCreateFunc) library.resolve("qt_meego_live_texture_create");
+ qt_meego_live_texture_lock = (QMeeGoLiveTextureLockFunc) library.resolve("qt_meego_live_texture_lock");
+ qt_meego_live_texture_unlock = (QMeeGoLiveTextureUnlockFunc) library.resolve("qt_meego_live_texture_unlock");
+ qt_meego_live_texture_destroy = (QMeeGoLiveTextureDestroyFunc) library.resolve("qt_meego_live_texture_destroy");
+ qt_meego_live_texture_query = (QMeeGoLiveTextureQueryFunc) library.resolve("qt_meego_live_texture_query");
+ qt_meego_live_texture_to_egl_image = (QMeeGoLiveTextureToEglImageFunc) library.resolve("qt_meego_live_texture_to_egl_image");
+
+ if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && qt_meego_pixmapdata_from_egl_image &&
+ qt_meego_pixmapdata_with_gl_texture && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap &&
+ qt_meego_set_surface_fixed_size && qt_meego_set_surface_scaling && qt_meego_set_translucent &&
+ qt_meego_live_texture_create && qt_meego_live_texture_lock && qt_meego_live_texture_unlock &&
+ qt_meego_live_texture_destroy && qt_meego_live_texture_query && qt_meego_live_texture_to_egl_image)
{
qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion));
}
@@ -108,18 +132,25 @@ Qt::HANDLE QMeeGoRuntime::imageToEGLSharedImage(const QImage &image)
return qt_meego_image_to_egl_shared_image(image);
}
-QPixmap QMeeGoRuntime::pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
+QPixmapData* QMeeGoRuntime::pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage)
{
ENSURE_INITIALIZED;
Q_ASSERT(qt_meego_pixmapdata_from_egl_shared_image);
- return QPixmap(qt_meego_pixmapdata_from_egl_shared_image(handle, softImage));
+ return qt_meego_pixmapdata_from_egl_shared_image(handle, softImage);
+}
+
+QPixmapData* QMeeGoRuntime::pixmapDataFromEGLImage(Qt::HANDLE handle)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_pixmapdata_from_egl_image);
+ return qt_meego_pixmapdata_from_egl_image(handle);
}
-QPixmap QMeeGoRuntime::pixmapWithGLTexture(int w, int h)
+QPixmapData* QMeeGoRuntime::pixmapDataWithGLTexture(int w, int h)
{
ENSURE_INITIALIZED;
Q_ASSERT(qt_meego_pixmapdata_with_gl_texture);
- return QPixmap(qt_meego_pixmapdata_with_gl_texture(w, h));
+ return qt_meego_pixmapdata_with_gl_texture(w, h);
}
bool QMeeGoRuntime::destroyEGLSharedImage(Qt::HANDLE handle)
@@ -156,3 +187,46 @@ void QMeeGoRuntime::setTranslucent(bool translucent)
Q_ASSERT(qt_meego_set_translucent);
qt_meego_set_translucent(translucent);
}
+
+Qt::HANDLE QMeeGoRuntime::createLiveTexture(int w, int h, QImage::Format format)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_create);
+ return qt_meego_live_texture_create(w, h, format);
+}
+
+bool QMeeGoRuntime::lockLiveTexture(Qt::HANDLE h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_lock);
+ return qt_meego_live_texture_lock(h);
+}
+
+bool QMeeGoRuntime::unlockLiveTexture(Qt::HANDLE h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_unlock);
+ return qt_meego_live_texture_unlock(h);
+}
+
+void QMeeGoRuntime::destroyLiveTexture(Qt::HANDLE h)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_destroy);
+ qt_meego_live_texture_destroy(h);
+}
+
+void QMeeGoRuntime::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_query);
+ qt_meego_live_texture_query(h, data, pitch);
+}
+
+Qt::HANDLE QMeeGoRuntime::liveTextureToEGLImage(Qt::HANDLE handle)
+{
+ ENSURE_INITIALIZED;
+ Q_ASSERT(qt_meego_live_texture_to_egl_image);
+ return qt_meego_live_texture_to_egl_image(handle);
+}
+
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h
index 82fdb52..048b9be 100644
--- a/tools/qmeegographicssystemhelper/qmeegoruntime.h
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h
@@ -48,13 +48,20 @@ public:
static void initialize();
static Qt::HANDLE imageToEGLSharedImage(const QImage &image);
- static QPixmap pixmapFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
- static QPixmap pixmapWithGLTexture(int w, int h);
+ static QPixmapData* pixmapDataFromEGLSharedImage(Qt::HANDLE handle, const QImage &softImage);
+ static QPixmapData* pixmapDataFromEGLImage(Qt::HANDLE handle);
+ static QPixmapData* pixmapDataWithGLTexture(int w, int h);
static bool destroyEGLSharedImage(Qt::HANDLE handle);
static void updateEGLSharedImagePixmap(QPixmap *p);
static void setSurfaceFixedSize(int w, int h);
static void setSurfaceScaling(int x, int y, int w, int h);
static void setTranslucent(bool translucent);
+ static Qt::HANDLE createLiveTexture(int w, int h, QImage::Format format);
+ static bool lockLiveTexture(Qt::HANDLE h);
+ static bool unlockLiveTexture(Qt::HANDLE h);
+ static void destroyLiveTexture(Qt::HANDLE h);
+ static void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch);
+ static Qt::HANDLE liveTextureToEGLImage(Qt::HANDLE);
private:
static bool initialized;
diff --git a/tools/qtconfig/paletteeditoradvanced.cpp b/tools/qtconfig/paletteeditoradvanced.cpp
index 2728557..f59584e 100644
--- a/tools/qtconfig/paletteeditoradvanced.cpp
+++ b/tools/qtconfig/paletteeditoradvanced.cpp
@@ -182,6 +182,7 @@ QColorGroup::ColorRole PaletteEditorAdvanced::centralFromItem( int item )
}
QColorGroup::ColorRole PaletteEditorAdvanced::effectFromItem( int item )
+
{
switch( item ) {
case 0: