diff options
author | Denis Oliver Kropp <dok@directfb.org> | 2011-02-04 13:50:00 (GMT) |
---|---|---|
committer | Marcel Schuette <marcel.schuette@nokia.com> | 2011-02-04 13:50:00 (GMT) |
commit | aa8d84efdc8e7dd26f36a3586050458d7be0c279 (patch) | |
tree | 59e311f5f3cc804df61f0a483fa06283a101819a /src | |
parent | de1cfc13c66fcb35d0a211bb5136ebc25279041a (diff) | |
download | Qt-aa8d84efdc8e7dd26f36a3586050458d7be0c279.zip Qt-aa8d84efdc8e7dd26f36a3586050458d7be0c279.tar.gz Qt-aa8d84efdc8e7dd26f36a3586050458d7be0c279.tar.bz2 |
directfb: Pixmap creation always premultiplied the alpha even when it is already premultiplied in the image.
This also avoids the temporary surface and blitting.
Merge-request: 990
Reviewed-by: Marcel Schuette <marcel.schuette@nokia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 6639983..50e0f5f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -300,40 +300,26 @@ void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags { alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags); imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); + QImage image; if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { image = img.convertToFormat(imageFormat, flags); flags = Qt::AutoColor; } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) { image = img.convertToFormat(imageFormat, flags); + } else if (img.format() != imageFormat) { + image = img.convertToFormat(imageFormat, flags); } else { image = img; } - IDirectFBSurface *imageSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::DontTrackSurface); - if (!imageSurface) { - qWarning("QDirectFBPixmapData::fromImage()"); - invalidate(); - return; - } - - dfbSurface = screen->createDFBSurface(image.size(), imageFormat, QDirectFBScreen::TrackSurface); + dfbSurface = screen->createDFBSurface(image, image.format(), QDirectFBScreen::NoPreallocated | QDirectFBScreen::TrackSurface); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage()"); invalidate(); return; } - if (image.hasAlphaChannel()) { - dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL); - } else { - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - } - - dfbSurface->Blit(dfbSurface, imageSurface, 0, 0, 0); - imageSurface->Release(imageSurface); - w = image.width(); h = image.height(); is_null = (w <= 0 || h <= 0); |