summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp14
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h4
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp6
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.cpp6
-rw-r--r--tools/qmeegographicssystemhelper/qmeegoruntime.h2
5 files changed, 20 insertions, 12 deletions
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index b378b13d68..27e728ac01 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -275,7 +275,7 @@ bool QMeeGoGraphicsSystem::unlockLiveTexture(Qt::HANDLE h)
}
}
-void QMeeGoGraphicsSystem::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch)
+void QMeeGoGraphicsSystem::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch, QImage::Format *f)
{
// FIXME Only allow this on locked surfaces
if (! liveTexturePixmaps.contains(h)) {
@@ -289,6 +289,14 @@ void QMeeGoGraphicsSystem::queryLiveTexture(Qt::HANDLE h, void **data, int *pitc
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);
+
+ // Ok, here we know we just support those two formats. Real solution would be:
+ // in liveTexturePixmaps store a small structure containing the pixmap and the
+ // original Qt format.
+ if (liveTexturePixmaps.value(h)->depth() > 16)
+ *f = QImage::Format_ARGB32_Premultiplied;
+ else
+ *f = QImage::Format_RGB16;
}
Qt::HANDLE QMeeGoGraphicsSystem::liveTextureToEGLImage(Qt::HANDLE h)
@@ -441,9 +449,9 @@ 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)
+void qt_meego_live_texture_query(Qt::HANDLE h, void **data, int *pitch, QImage::Format *f)
{
- return QMeeGoGraphicsSystem::queryLiveTexture(h, data, pitch);
+ return QMeeGoGraphicsSystem::queryLiveTexture(h, data, pitch, f);
}
Qt::HANDLE qt_meego_live_texture_to_egl_image(Qt::HANDLE h)
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
index 934d32d783..fad0db6727 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h
@@ -71,7 +71,7 @@ public:
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 void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch, QImage::Format *format);
static Qt::HANDLE liveTextureToEGLImage(Qt::HANDLE h);
private:
@@ -99,7 +99,7 @@ extern "C" {
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 void m_live_texture_query(Qt::HANDLE h, void **data, int *pitch, QImage::Format *f);
Q_DECL_EXPORT Qt::HANDLE m_live_texture_to_egl_image(Qt::HANDLE h);
}
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
index b9dbb2b015..5e36631a35 100644
--- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
@@ -118,20 +118,20 @@ QImage* QMeeGoLivePixmap::lock()
void *data = NULL;
int pitch = 0;
+ QImage::Format format;
if (! QMeeGoRuntime::lockLiveTexture(d->handle)) {
qWarning("Failed to lock a live texture!");
return new QImage();
}
- QMeeGoRuntime::queryLiveTexture(d->handle, &data, &pitch);
+ QMeeGoRuntime::queryLiveTexture(d->handle, &data, &pitch, &format);
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);
+ return new QImage((uchar *) data, width(), height(), format);
}
void QMeeGoLivePixmap::release(QImage *img)
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
index 44f9f585a6..215dffcff8 100644
--- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp
@@ -62,7 +62,7 @@ typedef Qt::HANDLE (*QMeeGoLiveTextureCreateFunc) (int w, int h, QImage::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 void (*QMeeGoLiveTextureQueryFunc) (Qt::HANDLE h, void **data, int *pitch, QImage::Format *format);
typedef Qt::HANDLE (*QMeeGoLiveTextureToEglImageFunc) (Qt::HANDLE h);
static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL;
@@ -216,11 +216,11 @@ void QMeeGoRuntime::destroyLiveTexture(Qt::HANDLE h)
qt_meego_live_texture_destroy(h);
}
-void QMeeGoRuntime::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch)
+void QMeeGoRuntime::queryLiveTexture(Qt::HANDLE h, void **data, int *pitch, QImage::Format *format)
{
ENSURE_INITIALIZED;
Q_ASSERT(qt_meego_live_texture_query);
- qt_meego_live_texture_query(h, data, pitch);
+ qt_meego_live_texture_query(h, data, pitch, format);
}
Qt::HANDLE QMeeGoRuntime::liveTextureToEGLImage(Qt::HANDLE handle)
diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h
index 048b9be2fb..9f2d50548e 100644
--- a/tools/qmeegographicssystemhelper/qmeegoruntime.h
+++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h
@@ -60,7 +60,7 @@ public:
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 void queryLiveTexture(Qt::HANDLE h, void **data, int *pitch, QImage::Format *format);
static Qt::HANDLE liveTextureToEGLImage(Qt::HANDLE);
private: