summaryrefslogtreecommitdiffstats
path: root/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-10-22 09:58:08 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-10-22 09:58:08 (GMT)
commit98824c2ebe97f61bf294b0be07ac164aed470fbf (patch)
tree0621c3002e2f2fe28fc6e39a14429928cc2aa072 /tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
parenta3c2f84f1a33610b86a600c68653b96de1d2b9f5 (diff)
parente5be06e53a33605a4f5987e9d451b2143470bdf4 (diff)
downloadQt-98824c2ebe97f61bf294b0be07ac164aed470fbf.zip
Qt-98824c2ebe97f61bf294b0be07ac164aed470fbf.tar.gz
Qt-98824c2ebe97f61bf294b0be07ac164aed470fbf.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: Fall back to Qt for loading images with DICAPS_COLORKEY. Implement QWidget::metric PdmNumColors for QWS Adding ::scroll capabilities to live pixmaps. Major refactoring: creating a new QPixmapData subclass for live textures.
Diffstat (limited to 'tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp')
-rw-r--r--tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp59
1 files changed, 15 insertions, 44 deletions
diff --git a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
index 5e36631..d43efe2 100644
--- a/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegolivepixmap.cpp
@@ -40,15 +40,12 @@
****************************************************************************/
#include "qmeegolivepixmap.h"
-#include <private/qimage_p.h>
-#include <private/qpixmap_raster_p.h>
#include "qmeegolivepixmap_p.h"
#include "qmeegoruntime.h"
-#include <QSharedMemory>
/* QMeeGoLivePixmapPrivate */
-QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate(Qt::HANDLE h) : handle(h)
+QMeeGoLivePixmapPrivate::QMeeGoLivePixmapPrivate()
{
}
@@ -60,7 +57,7 @@ QMeeGoLivePixmapPrivate::~QMeeGoLivePixmapPrivate()
QMeeGoLivePixmap* QMeeGoLivePixmap::livePixmapWithSize(int w, int h, Format format)
{
- QImage::Format qtFormat;
+ QImage::Format qtFormat;
if (format == Format_RGB16)
qtFormat = QImage::Format_RGB16;
else if (format == Format_ARGB32_Premultiplied)
@@ -69,17 +66,17 @@ QMeeGoLivePixmap* QMeeGoLivePixmap::livePixmapWithSize(int w, int h, Format form
qWarning("Unsupported live pixmap format!");
return 0;
}
-
- Qt::HANDLE liveTextureHandle = QMeeGoRuntime::createLiveTexture(w, h, qtFormat);
- if (! liveTextureHandle) {
+
+ QPixmapData *pmd = QMeeGoRuntime::pixmapDataWithNewLiveTexture(w, h, qtFormat);
+ if (! pmd) {
qWarning("Failed to create a live texture with given size!");
return NULL;
}
- return QMeeGoLivePixmap::fromHandle(liveTextureHandle);
+ return new QMeeGoLivePixmap(pmd);
}
-QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p, Qt::HANDLE h) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate(h))
+QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p) : QPixmap(p), d_ptr(new QMeeGoLivePixmapPrivate())
{
Q_D(QMeeGoLivePixmap);
d->q_ptr = this;
@@ -87,25 +84,18 @@ QMeeGoLivePixmap::QMeeGoLivePixmap(QPixmapData *p, Qt::HANDLE h) : QPixmap(p), d
QMeeGoLivePixmap* QMeeGoLivePixmap::fromHandle(Qt::HANDLE liveTextureHandle)
{
- Qt::HANDLE eglImage = QMeeGoRuntime::liveTextureToEGLImage(liveTextureHandle);
- if (! eglImage) {
- qWarning("Failed to bind the live texture as an egl image!");
- return NULL;
- }
-
- QPixmapData *pmd = QMeeGoRuntime::pixmapDataFromEGLImage(eglImage);
+ QPixmapData *pmd = QMeeGoRuntime::pixmapDataFromLiveTextureHandle(liveTextureHandle);
if (! pmd) {
- qWarning("Failed to allocate a pixmap data from a given live texture egl image!");
+ qWarning("Failed to create a live texture from given handle!");
return NULL;
}
-
- return new QMeeGoLivePixmap(pmd, liveTextureHandle);
+
+ return new QMeeGoLivePixmap(pmd);
}
Qt::HANDLE QMeeGoLivePixmap::handle()
{
- Q_D(QMeeGoLivePixmap);
- return d->handle;
+ return QMeeGoRuntime::getLiveTextureHandle(this);
}
QMeeGoLivePixmap::~QMeeGoLivePixmap()
@@ -114,30 +104,11 @@ QMeeGoLivePixmap::~QMeeGoLivePixmap()
QImage* QMeeGoLivePixmap::lock()
{
- Q_D(QMeeGoLivePixmap);
+ return QMeeGoRuntime::lockLiveTexture(this);
- 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, &format);
- if (data == NULL || pitch == 0) {
- qWarning("Failed to query the live texture!");
- return new QImage();
- }
-
- return new QImage((uchar *) data, width(), height(), format);
}
-
+
void QMeeGoLivePixmap::release(QImage *img)
{
- Q_D(QMeeGoLivePixmap);
- // FIXME Make sure we're locked!
- QMeeGoRuntime::unlockLiveTexture(d->handle);
- delete img;
+ QMeeGoRuntime::releaseLiveTexture(this, img);
}