diff options
Diffstat (limited to 'src/plugins/gfxdrivers/directfb')
4 files changed, 68 insertions, 60 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index 46cf65b..cb4fb88 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -209,6 +209,7 @@ void QDirectFBPaintDevice::releaseSubSurface() { Q_ASSERT(QDirectFBScreen::instance()); if (subSurface) { + unlockSurface(); screen->releaseDFBSurface(subSurface); subSurface = 0; } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 043189e..dd6b0d3 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -284,7 +284,9 @@ bool QDirectFBPaintEngine::begin(QPaintDevice *device) } d->prepare(d->dfbDevice); + gccaps = AllFeatures; d->setCompositionMode(state()->composition_mode); + return QRasterPaintEngine::begin(device); } @@ -1249,7 +1251,7 @@ static void rasterFallbackWarn(const char *msg, const char *func, const device * dbg << dev << "of type" << dev->devType(); } - dbg << QString("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0')) + dbg << QString::fromLatin1("transformationType 0x%1").arg(transformationType, 3, 16, QLatin1Char('0')) << "simplePen" << simplePen << "clipType" << clipType << "compositionModeStatus" << compositionModeStatus; diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index 19103cb..f33e820 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -81,18 +81,23 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) { + SurfaceFlags flags = 0; + if (!widget || widget->window()->windowOpacity() == 0xff) + flags |= Opaque; #ifdef QT_NO_DIRECTFB_WM if (widget && widget->testAttribute(Qt::WA_PaintOnScreen)) { - setSurfaceFlags(Opaque | RegionReserved); + flags = RegionReserved; mode = Primary; } else { mode = Offscreen; - setSurfaceFlags(Opaque | Buffered); + flags = Buffered; } #else - setSurfaceFlags(Opaque | Buffered); + noSystemBackground = widget && widget->testAttribute(Qt::WA_NoSystemBackground); + if (noSystemBackground) + flags &= ~Opaque; #endif - + setSurfaceFlags(flags); #ifdef QT_DIRECTFB_TIMING frames = 0; timer.start(); @@ -135,6 +140,16 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect) description.caps = DWCAPS_NODECORATION|DWCAPS_DOUBLEBUFFER; description.flags = DWDESC_CAPS|DWDESC_SURFACE_CAPS|DWDESC_PIXELFORMAT|DWDESC_HEIGHT|DWDESC_WIDTH|DWDESC_POSX|DWDESC_POSY; +#if (Q_DIRECTFB_VERSION >= 0x010200) + description.flags |= DWDESC_OPTIONS; +#endif + + if (noSystemBackground) { + description.caps |= DWCAPS_ALPHACHANNEL; +#if (Q_DIRECTFB_VERSION >= 0x010200) + description.options |= DWOP_ALPHACHANNEL; +#endif + } description.posx = rect.x(); description.posy = rect.y(); @@ -143,7 +158,7 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect) description.surface_caps = DSCAPS_NONE; if (screen->directFBFlags() & QDirectFBScreen::VideoOnly) description.surface_caps |= DSCAPS_VIDEOONLY; - const QImage::Format format = screen->pixelFormat(); + const QImage::Format format = (noSystemBackground ? screen->alphaPixmapFormat() : screen->pixelFormat()); description.pixelformat = QDirectFBScreen::getSurfacePixelFormat(format); if (QDirectFBScreen::isPremultiplied(format)) description.surface_caps = DSCAPS_PREMULTIPLIED; @@ -153,9 +168,7 @@ void QDirectFBWindowSurface::createWindow(const QRect &rect) if (result != DFB_OK) DirectFBErrorFatal("QDirectFBWindowSurface::createWindow", result); - if (dfbSurface) - dfbSurface->Release(dfbSurface); - + Q_ASSERT(!dfbSurface); dfbWindow->GetSurface(dfbWindow, &dfbSurface); updateFormat(); } @@ -200,10 +213,6 @@ void QDirectFBWindowSurface::setGeometry(const QRect &rect) if (sizeChanged) { delete engine; engine = 0; - unlockSurface(); -#ifdef QT_DIRECTFB_SUBSURFACE - releaseSubSurface(); -#endif releaseSurface(); Q_ASSERT(!dfbSurface); } @@ -301,29 +310,20 @@ bool QDirectFBWindowSurface::move(const QPoint &moveBy) return true; } -// hw: XXX: copied from QWidgetPrivate::isOpaque() -inline bool isWidgetOpaque(const QWidget *w) +void QDirectFBWindowSurface::setOpaque(bool opaque) { - if (w->testAttribute(Qt::WA_OpaquePaintEvent) - || w->testAttribute(Qt::WA_PaintOnScreen)) - return true; - - const QPalette &pal = w->palette(); - - if (w->autoFillBackground()) { - const QBrush &autoFillBrush = pal.brush(w->backgroundRole()); - if (autoFillBrush.style() != Qt::NoBrush && autoFillBrush.isOpaque()) - return true; + SurfaceFlags flags = surfaceFlags(); + if (opaque != (flags & Opaque)) { + if (opaque) { + flags |= Opaque; + } else { + flags &= ~Opaque; + } + setSurfaceFlags(flags); } +} - if (!w->testAttribute(Qt::WA_NoSystemBackground)) { - const QBrush &windowBrush = w->palette().brush(QPalette::Window); - if (windowBrush.style() != Qt::NoBrush && windowBrush.isOpaque()) - return true; - } - return false; -} void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { @@ -335,37 +335,39 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, if (extra && extra->proxyWidget) return; - // hw: make sure opacity information is updated before compositing - const bool opaque = isWidgetOpaque(win); - if (opaque != isOpaque()) { - SurfaceFlags flags = surfaceFlags(); - if (opaque) { - flags |= Opaque; - } else { - flags &= ~Opaque; - } - setSurfaceFlags(flags); + const quint8 windowOpacity = quint8(win->windowOpacity() * 0xff); + const QRect windowGeometry = geometry(); +#ifdef QT_DIRECTFB_WM + const bool wasNoSystemBackground = noSystemBackground; + noSystemBackground = win->testAttribute(Qt::WA_NoSystemBackground); + quint8 currentOpacity; + Q_ASSERT(dfbWindow); + dfbWindow->GetOpacity(dfbWindow, ¤tOpacity); + if (currentOpacity != windowOpacity) { + dfbWindow->SetOpacity(dfbWindow, windowOpacity); } -#ifndef QT_NO_DIRECTFB_WM - const quint8 winOpacity = quint8(win->windowOpacity() * 255); - quint8 opacity; - - if (dfbWindow) { - dfbWindow->GetOpacity(dfbWindow, &opacity); - if (winOpacity != opacity) - dfbWindow->SetOpacity(dfbWindow, winOpacity); + setOpaque(noSystemBackground || windowOpacity != 0xff); + if (wasNoSystemBackground != noSystemBackground) { + releaseSurface(); + dfbWindow->Release(dfbWindow); + dfbWindow = 0; + createWindow(windowGeometry); + win->update(); + return; } -#endif - - const QRect windowGeometry = QDirectFBWindowSurface::geometry(); -#ifdef QT_NO_DIRECTFB_WM + screen->flipSurface(dfbSurface, flipFlags, region, offset); + if (noSystemBackground) { + dfbSurface->Clear(dfbSurface, 0, 0, 0, 0); + } +#else + setOpaque(windowOpacity != 0xff); if (mode == Offscreen) { screen->exposeRegion(region.translated(offset + geometry().topLeft()), 0); - - } else -#endif + } else { screen->flipSurface(dfbSurface, flipFlags, region, offset); + } +#endif #ifdef QT_DIRECTFB_TIMING enum { Secs = 3 }; @@ -430,9 +432,10 @@ void QDirectFBWindowSurface::updateFormat() void QDirectFBWindowSurface::releaseSurface() { if (dfbSurface) { -#ifdef QT_NO_DIRECTFB_SUBSURFACE - if (lockFlgs) - unlockSurface(); +#ifdef QT_DIRECTFB_SUBSURFACE + releaseSubSurface(); +#else + unlockSurface(); #endif #ifdef QT_NO_DIRECTFB_WM Q_ASSERT(screen->primarySurface()); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index 0dd3a3b..2f78179 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -97,6 +97,7 @@ public: IDirectFBWindow *directFBWindow() const; #endif private: + void setOpaque(bool opaque); void updateFormat(); void releaseSurface(); QDirectFBWindowSurface *sibling; @@ -112,6 +113,7 @@ private: #endif DFBSurfaceFlipFlags flipFlags; + bool noSystemBackground; bool boundingRectFlip; #ifdef QT_DIRECTFB_TIMING int frames; |