summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/directfb/qdirectfbcursor.cpp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-12-13 11:02:33 (GMT)
committerJørgen Lind <jorgen.lind@nokia.com>2011-12-13 11:02:33 (GMT)
commitc614e71cdd4047bb49ccde2f94c9d622f5071fc3 (patch)
tree8e97a2917bc3002722d0cd9b995ceb4a652c4615 /src/plugins/platforms/directfb/qdirectfbcursor.cpp
parentee387dcb715ebc21f63b524bb87a8ffaf198f8aa (diff)
downloadQt-c614e71cdd4047bb49ccde2f94c9d622f5071fc3.zip
Qt-c614e71cdd4047bb49ccde2f94c9d622f5071fc3.tar.gz
Qt-c614e71cdd4047bb49ccde2f94c9d622f5071fc3.tar.bz2
directfb: Backport the work from QtBase to Qt 4.8
This is copying the files (minus the API changes) to Qt 4.8. It fixes memory leaks, adds DirectFB based image decoding, prepares EGL integration/ Merge-request: 1492 Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
Diffstat (limited to 'src/plugins/platforms/directfb/qdirectfbcursor.cpp')
-rw-r--r--src/plugins/platforms/directfb/qdirectfbcursor.cpp34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbcursor.cpp b/src/plugins/platforms/directfb/qdirectfbcursor.cpp
index 8a38bc4..ea9be84 100644
--- a/src/plugins/platforms/directfb/qdirectfbcursor.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbcursor.cpp
@@ -42,26 +42,25 @@
#include "qdirectfbcursor.h"
#include "qdirectfbconvenience.h"
+QT_BEGIN_NAMESPACE
-QDirectFBCursor::QDirectFBCursor(QPlatformScreen* screen) :
- QPlatformCursor(screen), surface(0)
+QDirectFBCursor::QDirectFBCursor(QPlatformScreen *screen)
+ : QPlatformCursor(screen)
{
- QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),DLID_PRIMARY, &m_layer);
- image = new QPlatformCursorImage(0, 0, 0, 0, 0, 0);
+ m_image.reset(new QPlatformCursorImage(0, 0, 0, 0, 0, 0));
}
-void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget)
+void QDirectFBCursor::changeCursor(QCursor *cursor, QWidget *)
{
- Q_UNUSED(widget);
int xSpot;
int ySpot;
QPixmap map;
if (cursor->shape() != Qt::BitmapCursor) {
- image->set(cursor->shape());
- xSpot = image->hotspot().x();
- ySpot = image->hotspot().y();
- QImage *i = image->image();
+ m_image->set(cursor->shape());
+ xSpot = m_image->hotspot().x();
+ ySpot = m_image->hotspot().y();
+ QImage *i = m_image->image();
map = QPixmap::fromImage(*i);
} else {
QPoint point = cursor->hotSpot();
@@ -70,11 +69,18 @@ void QDirectFBCursor::changeCursor(QCursor * cursor, QWidget * widget)
map = cursor->pixmap();
}
- IDirectFBSurface *surface = QDirectFbConvenience::dfbSurfaceForPixmapData(map.pixmapData());
+ DFBResult res;
+ IDirectFBDisplayLayer *layer = toDfbLayer(screen);
+ IDirectFBSurface* surface(QDirectFbConvenience::dfbSurfaceForPlatformPixmap(map.pixmapData()));
- if (m_layer->SetCooperativeLevel(m_layer, DLSCL_ADMINISTRATIVE) != DFB_OK) {
+ res = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
+ if (res != DFB_OK) {
+ DirectFBError("Failed to set DLSCL_ADMINISTRATIVE", res);
return;
}
- m_layer->SetCursorShape( m_layer, surface, xSpot, ySpot);
- m_layer->SetCooperativeLevel(m_layer, DLSCL_SHARED);
+
+ layer->SetCursorShape(layer, surface, xSpot, ySpot);
+ layer->SetCooperativeLevel(layer, DLSCL_SHARED);
}
+
+QT_END_NAMESPACE