summaryrefslogtreecommitdiffstats
path: root/src/plugins/graphicssystems
diff options
context:
space:
mode:
authorMichael Dominic K <mdk@codethink.co.uk>2010-10-13 09:40:51 (GMT)
committerSamuel Rødal <samuel.rodal@nokia.com>2010-10-13 09:40:51 (GMT)
commit6f1f1317e68a261173ddb24a045dcc823b16a3bd (patch)
tree0a081569d47f3867130c138c4f3763d129b0dace /src/plugins/graphicssystems
parentfa6bad3c703fdb2d0218972c5774ed0a61948f84 (diff)
downloadQt-6f1f1317e68a261173ddb24a045dcc823b16a3bd.zip
Qt-6f1f1317e68a261173ddb24a045dcc823b16a3bd.tar.gz
Qt-6f1f1317e68a261173ddb24a045dcc823b16a3bd.tar.bz2
Correctly handle both 16bit and 32bit live pixmaps in meego graphics system.
Merge-request: 856 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/plugins/graphicssystems')
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.cpp14
-rw-r--r--src/plugins/graphicssystems/meego/qmeegographicssystem.h4
2 files changed, 13 insertions, 5 deletions
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index b378b13..27e728a 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 934d32d..fad0db6 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);
}