From 80d83e72fca6a60ca9cfec8bfa37a82087c931a9 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 31 Mar 2009 18:10:26 -0700 Subject: Make windows the right formats and videoonly CreateWindow gives you more control over how windows are created. Make sure to specify that they're in the same format as the primary surface and that they're in video memory if this is supported. Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp index ec108c4..15c2f7c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbsurface.cpp @@ -98,10 +98,19 @@ void QDirectFBSurface::createWindow() if (!layer) qFatal("QDirectFBWindowSurface: Unable to get primary display layer!"); - DFBWindowDescription description; - description.caps = DFBWindowCapabilities(DWCAPS_NODECORATION | - DWCAPS_ALPHACHANNEL); - description.flags = DWDESC_CAPS; + DFBWindowDescription description; + description.caps = DFBWindowCapabilities(DWCAPS_NODECORATION); + description.flags = DFBWindowDescriptionFlags(DWDESC_CAPS + |DWDESC_SURFACE_CAPS + |DWDESC_PIXELFORMAT); + + description.surface_caps = DSCAPS_NONE; + if (QDirectFBScreen::instance()->preferVideoOnly()) + description.surface_caps = DFBSurfaceCapabilities(description.surface_caps|DSCAPS_VIDEOONLY); + const QImage::Format format = QDirectFBScreen::instance()->pixelFormat(); + description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); + if (QDirectFBScreen::isPremultiplied(format)) + description.surface_caps = DFBSurfaceCapabilities(DSCAPS_PREMULTIPLIED|description.caps); DFBResult result = layer->CreateWindow(layer, &description, &dfbWindow); if (result != DFB_OK) @@ -111,7 +120,7 @@ void QDirectFBSurface::createWindow() dfbSurface->Release(dfbSurface); dfbWindow->GetSurface(dfbWindow, &dfbSurface); - forceRaster = (dfbSurface && QDirectFBScreen::getImageFormat(dfbSurface) == QImage::Format_RGB32); + forceRaster = (format == QImage::Format_RGB32); } #endif // QT_NO_DIRECTFB_WM -- cgit v0.12