summaryrefslogtreecommitdiffstats
path: root/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp')
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp59
1 files changed, 34 insertions, 25 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 6d942a4..3099205 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -71,15 +71,10 @@ void QDirectFBPixmapData::resize(int width, int height)
return;
}
- DFBSurfaceDescription description;
- description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH
- | DSDESC_HEIGHT
- | DSDESC_PIXELFORMAT);
- QDirectFBScreen::initSurfaceDescriptionPixelFormat(&description, screen->pixelFormat());
- description.width = width;
- description.height = height;
-
- dfbSurface = screen->createDFBSurface(&description, QDirectFBScreen::TrackSurface);
+ dfbSurface = QDirectFBScreen::instance()->createDFBSurface(QSize(width, height),
+ screen->pixelFormat(),
+ QDirectFBScreen::TrackSurface);
+ forceRaster = (screen->pixelFormat() == QImage::Format_RGB32);
if (!dfbSurface) {
setSerialNumber(0);
qWarning("QDirectFBPixmapData::resize(): Unable to allocate surface");
@@ -92,10 +87,12 @@ void QDirectFBPixmapData::resize(int width, int height)
void QDirectFBPixmapData::fromImage(const QImage &img,
Qt::ImageConversionFlags)
{
- dfbSurface = screen->copyToDFBSurface(img,
- img.hasAlphaChannel() ? screen->alphaPixmapFormat()
- : screen->pixelFormat(),
- QDirectFBScreen::TrackSurface);
+ const QImage::Format format = img.hasAlphaChannel() ?
+ screen->alphaPixmapFormat()
+ : screen->pixelFormat();
+ dfbSurface = screen->copyToDFBSurface(img, format,
+ QDirectFBScreen::TrackSurface);
+ forceRaster = (format == QImage::Format_RGB32);
if (!dfbSurface) {
qWarning("QDirectFBPixmapData::fromImage()");
setSerialNumber(0);
@@ -112,22 +109,18 @@ void QDirectFBPixmapData::copy(const QPixmapData *data, const QRect &rect)
}
IDirectFBSurface *src = static_cast<const QDirectFBPixmapData*>(data)->directFbSurface();
+ const QImage::Format format = (data->hasAlphaChannel()
+ ? QDirectFBScreen::instance()->alphaPixmapFormat()
+ : QDirectFBScreen::instance()->pixelFormat());
- DFBSurfaceDescription description;
- description.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH |
- DSDESC_HEIGHT |
- DSDESC_PIXELFORMAT);
- description.width = rect.width();
- description.height = rect.height();
- src->GetPixelFormat(src, &description.pixelformat);
- src->GetCapabilities(src, &description.caps);
-
- dfbSurface = screen->createDFBSurface(&description, QDirectFBScreen::TrackSurface);
+ dfbSurface = screen->createDFBSurface(rect.size(), format,
+ QDirectFBScreen::TrackSurface);
if (!dfbSurface) {
qWarning("QDirectFBPixmapData::copy()");
setSerialNumber(0);
return;
}
+ forceRaster = (format == QImage::Format_RGB32);
dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
const DFBRectangle blitRect = { rect.x(), rect.y(),
@@ -160,6 +153,7 @@ void QDirectFBPixmapData::fill(const QColor &color)
screen->releaseDFBSurface(dfbSurface); // release old surface
dfbSurface = screen->createDFBSurface(&description, QDirectFBScreen::TrackSurface);
+ forceRaster = false;
setSerialNumber(++global_ser_no);
if (!dfbSurface) {
qWarning("QDirectFBPixmapData::fill()");
@@ -168,8 +162,23 @@ void QDirectFBPixmapData::fill(const QColor &color)
}
}
- dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(),
- color.alpha());
+ if (forceRaster) {
+ // in DSPF_RGB32 all dfb drawing causes the Alpha byte to be
+ // set to 0. This causes issues for the raster engine.
+ char *mem;
+ int bpl;
+ const int h = QPixmapData::height();
+ dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl);
+ const int c = color.rgba();
+ for (int i = 0; i < h; ++i) {
+ memset(mem, c, bpl);
+ mem += bpl;
+ }
+ dfbSurface->Unlock(dfbSurface);
+ } else {
+ dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(),
+ color.alpha());
+ }
}
bool QDirectFBPixmapData::hasAlphaChannel() const