summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers/directfb
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gfxdrivers/directfb')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp46
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbscreen.h12
3 files changed, 37 insertions, 23 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
index c5b5158..e63a628 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp
@@ -1133,7 +1133,7 @@ IDirectFBSurface *SurfaceCache::getSurface(const uint *buf, int size)
clear();
const DFBSurfaceDescription description = QDirectFBScreen::getSurfaceDescription(buf, size);
- surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface);
+ surface = QDirectFBScreen::instance()->createDFBSurface(description, QDirectFBScreen::TrackSurface, 0);
if (!surface)
qWarning("QDirectFBPaintEngine: SurfaceCache: Unable to create surface");
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
index fcadb89..f7b3e08 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp
@@ -150,7 +150,7 @@ QDirectFBScreenPrivate::~QDirectFBScreenPrivate()
dfb->Release(dfb);
}
-IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options)
+IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *resultPtr)
{
if (image.isNull()) // assert?
return 0;
@@ -159,7 +159,7 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage:
format = QDirectFBPixmapData::hasAlphaChannel(image) ? d_ptr->alphaPixmapFormat : pixelFormat();
}
if (image.format() != format) {
- return createDFBSurface(image.convertToFormat(format), format, options | NoPreallocated);
+ return createDFBSurface(image.convertToFormat(format), format, options | NoPreallocated, resultPtr);
}
DFBSurfaceDescription description;
@@ -179,9 +179,12 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage:
description.preallocated[1].pitch = 0;
}
#endif
- IDirectFBSurface *surface = createDFBSurface(description, options);
+ DFBResult result;
+ IDirectFBSurface *surface = createDFBSurface(description, options, &result);
+ if (resultPtr)
+ *resultPtr = result;
if (!surface) {
- qWarning("Couldn't create surface createDFBSurface(QImage, QImage::Format, SurfaceCreationOptions): error 1");
+ DirectFBError("Couldn't create surface createDFBSurface(QImage, QImage::Format, SurfaceCreationOptions)", result);
return 0;
}
if (doMemCopy) {
@@ -209,15 +212,14 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QImage &image, QImage:
IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src,
QImage::Format format,
- SurfaceCreationOptions options)
+ SurfaceCreationOptions options,
+ DFBResult *result)
{
Q_ASSERT(src);
QSize size;
src->GetSize(src, &size.rwidth(), &size.rheight());
- IDirectFBSurface *surface = createDFBSurface(size, format, options);
- DFBSurfacePixelFormat dspf;
- src->GetPixelFormat(src, &dspf);
- DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlphaChannel(dspf)
+ IDirectFBSurface *surface = createDFBSurface(size, format, options, result);
+ DFBSurfaceBlittingFlags flags = QDirectFBScreen::hasAlphaChannel(surface)
? DSBLIT_BLEND_ALPHACHANNEL
: DSBLIT_NOFX;
if (flags & DSBLIT_BLEND_ALPHACHANNEL)
@@ -233,7 +235,8 @@ IDirectFBSurface *QDirectFBScreen::copyDFBSurface(IDirectFBSurface *src,
IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size,
QImage::Format format,
- SurfaceCreationOptions options)
+ SurfaceCreationOptions options,
+ DFBResult *result)
{
DFBSurfaceDescription desc;
memset(&desc, 0, sizeof(DFBSurfaceDescription));
@@ -242,12 +245,14 @@ IDirectFBSurface *QDirectFBScreen::createDFBSurface(const QSize &size,
return 0;
desc.width = size.width();
desc.height = size.height();
- return createDFBSurface(desc, options);
+ return createDFBSurface(desc, options, result);
}
-IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options)
+IDirectFBSurface *QDirectFBScreen::createDFBSurface(DFBSurfaceDescription desc, SurfaceCreationOptions options, DFBResult *resultPtr)
{
- DFBResult result = DFB_OK;
+ DFBResult tmp;
+ DFBResult &result = (resultPtr ? *resultPtr : tmp);
+ result = DFB_OK;
IDirectFBSurface *newSurface = 0;
if (!d_ptr->dfb) {
@@ -570,13 +575,14 @@ void QDirectFBScreenCursor::set(const QImage &image, int hotx, int hoty)
cursor = image.convertToFormat(screen->alphaPixmapFormat());
size = cursor.size();
hotspot = QPoint(hotx, hoty);
+ DFBResult result = DFB_OK;
IDirectFBSurface *surface = screen->createDFBSurface(cursor, screen->alphaPixmapFormat(),
- QDirectFBScreen::DontTrackSurface);
+ QDirectFBScreen::DontTrackSurface, &result);
if (!surface) {
- qWarning("QDirectFBScreenCursor::set: Unable to create surface");
+ DirectFBError("QDirectFBScreenCursor::set: Unable to create surface", result);
return;
}
- DFBResult result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
+ result = layer->SetCooperativeLevel(layer, DLSCL_ADMINISTRATIVE);
if (result != DFB_OK) {
DirectFBError("QDirectFBScreenCursor::show: "
"Unable to set cooperative level", result);
@@ -934,7 +940,7 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
}
// We don't track the primary surface as it's released in disconnect
- d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface);
+ d_ptr->primarySurface = createDFBSurface(description, DontTrackSurface, &result);
if (!d_ptr->primarySurface) {
DirectFBError("QDirectFBScreen: error creating primary surface",
result);
@@ -945,7 +951,11 @@ bool QDirectFBScreen::connect(const QString &displaySpec)
#else
description.flags = DSDESC_WIDTH|DSDESC_HEIGHT;
description.width = description.height = 1;
- surface = createDFBSurface(description, DontTrackSurface);
+ surface = createDFBSurface(description, DontTrackSurface, &result);
+ if (!surface) {
+ DirectFBError("QDirectFBScreen: error creating surface", result);
+ return false;
+ }
#endif
// Work out what format we're going to use for surfaces with an alpha channel
QImage::Format pixelFormat = QDirectFBScreen::getImageFormat(surface);
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
index 67df739..5778b05 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h
@@ -149,13 +149,16 @@ public:
Q_DECLARE_FLAGS(SurfaceCreationOptions, SurfaceCreationOption);
IDirectFBSurface *createDFBSurface(const QImage &image,
QImage::Format format,
- SurfaceCreationOptions options);
+ SurfaceCreationOptions options,
+ DFBResult *result = 0);
IDirectFBSurface *createDFBSurface(const QSize &size,
QImage::Format format,
- SurfaceCreationOptions options);
+ SurfaceCreationOptions options,
+ DFBResult *result = 0);
IDirectFBSurface *copyDFBSurface(IDirectFBSurface *src,
QImage::Format format,
- SurfaceCreationOptions options);
+ SurfaceCreationOptions options,
+ DFBResult *result = 0);
void flipSurface(IDirectFBSurface *surface, DFBSurfaceFlipFlags flipFlags,
const QRegion &region, const QPoint &offset);
void releaseDFBSurface(IDirectFBSurface *surface);
@@ -182,7 +185,8 @@ public:
static uchar *lockSurface(IDirectFBSurface *surface, uint flags, int *bpl = 0);
private:
IDirectFBSurface *createDFBSurface(DFBSurfaceDescription desc,
- SurfaceCreationOptions options);
+ SurfaceCreationOptions options,
+ DFBResult *result);
QDirectFBScreenPrivate *d_ptr;
friend class SurfaceCache;
};