From 0002b0285269f69648a7eede33a1d9df5fab8c53 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 6 Apr 2009 18:20:28 -0700 Subject: Fix up some QT_...NO_PALETTE codepaths Make sure we create the surface from the converted image and not the original one. Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 39a2d48..dd147cf 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -171,7 +171,7 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCr } #endif #ifndef QT_NO_DIRECTFB_PALETTE - if (img.numColors() != 0) + if (img.numColors() != 0 && surface) QDirectFBScreen::setSurfaceColorTable(surface, img); #endif return surface; @@ -261,19 +261,21 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, #ifdef QT_NO_DIRECTFB_PREALLOCATED || image.format() != pixmapFormat #endif +#ifdef QT_NO_DIRECTFB_PALETTE + || image.numColors() != 0 +#endif ) { image = image.convertToFormat(pixmapFormat); } - - IDirectFBSurface *dfbSurface = createDFBSurface(img.size(), pixmapFormat, options); + IDirectFBSurface *dfbSurface = createDFBSurface(image.size(), pixmapFormat, options); if (!dfbSurface) { qWarning("QDirectFBPixmapData::fromImage() Couldn't create surface"); return 0; } #ifndef QT_NO_DIRECTFB_PREALLOCATED - IDirectFBSurface *imgSurface = createDFBSurface(img, DontTrackSurface); + IDirectFBSurface *imgSurface = createDFBSurface(image, DontTrackSurface); if (!imgSurface) { qWarning("QDirectFBPixmapData::fromImage()"); QDirectFBScreen::releaseDFBSurface(dfbSurface); -- cgit v0.12