summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/directfb/qdirectfbconvenience.cpp')
-rw-r--r--src/plugins/platforms/directfb/qdirectfbconvenience.cpp37
1 files changed, 29 insertions, 8 deletions
diff --git a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
index 37810dc..83c71b3 100644
--- a/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbconvenience.cpp
@@ -41,16 +41,22 @@
#include "qdirectfbconvenience.h"
#include "qdirectfbblitter.h"
+#include "qdirectfbscreen.h"
#include <private/qpixmap_blitter_p.h>
+#include <QtGui/QWidget>
+#include <QtGui/QScreen>
+
+QT_BEGIN_NAMESPACE
+
IDirectFB *QDirectFbConvenience::dfbInterface()
{
static IDirectFB *dfb = 0;
if (!dfb) {
DFBResult result = DirectFBCreate(&dfb);
if (result != DFB_OK) {
- DirectFBError("QDirectFBConvenience: error creating DirectFB interface",result);
+ DirectFBErrorFatal("QDirectFBConvenience: error creating DirectFB interface", result);
return 0;
}
}
@@ -61,10 +67,9 @@ IDirectFBDisplayLayer *QDirectFbConvenience::dfbDisplayLayer(int display)
{
IDirectFBDisplayLayer *layer;
DFBResult result = QDirectFbConvenience::dfbInterface()->GetDisplayLayer(QDirectFbConvenience::dfbInterface(),display,&layer);
- if (result != DFB_OK) {
- DirectFBError("QDirectFbConvenience: "
- "Unable to get primary display layer!", result);
- }
+ if (result != DFB_OK)
+ DirectFBErrorFatal("QDirectFbConvenience: "
+ "Unable to get primary display layer!", result);
return layer;
}
@@ -106,13 +111,17 @@ int QDirectFbConvenience::colorDepthForSurface(const DFBSurfacePixelFormat forma
return ((0x1f << 7) & format) >> 7;
}
-IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPixmapData(QPixmapData *pixmapData)
+/**
+ * This is borrowing the reference of the QDirectFbBlitter. You may not store this
+ * pointer as a class member but must only use it locally.
+ */
+IDirectFBSurface *QDirectFbConvenience::dfbSurfaceForPlatformPixmap(QPixmapData *handle)
{
- QBlittablePixmapData *blittablePmData = static_cast<QBlittablePixmapData *>(pixmapData);
+ QBlittablePixmapData *blittablePmData = static_cast<QBlittablePixmapData *>(handle);
if (blittablePmData) {
QBlittable *blittable = blittablePmData->blittable();
QDirectFbBlitter *dfbBlitter = static_cast<QDirectFbBlitter *>(blittable);
- return dfbBlitter->m_surface;
+ return dfbBlitter->m_surface.data();
}
return 0;
}
@@ -374,3 +383,15 @@ QDirectFbKeyMap::QDirectFbKeyMap()
insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight);
insert(DIKS_TILDE , Qt::Key_AsciiTilde);
}
+
+QDirectFbScreen *toDfbScreen(QWidget *window)
+{
+ return static_cast<QDirectFbScreen*>(QPlatformScreen::platformScreenForWidget(window));
+}
+
+IDirectFBDisplayLayer *toDfbLayer(QPlatformScreen *screen)
+{
+ return static_cast<QDirectFbScreen*>(screen)->dfbLayer();
+}
+
+QT_END_NAMESPACE