From b106ddb649ec0260486755ff7a87bbdc719785d1 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 9 Apr 2009 09:34:14 -0700 Subject: Fix setOpacity Opacity doesn't play well with PorterDuff so we need to disable the porter duff when opacity is set. Also the DSBLIT_SRC_PREMULTCOLOR flag is not the right thing for us. Reviewed-by: TrustMe --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 24d77bf..a8fdff8 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -440,10 +440,9 @@ void QDirectFBPaintEnginePrivate::setOpacity(quint8 op) { opacity = op; if (opacity == 255) { - // ### need to check this stuff - blitFlagsFromCompositionMode &= ~(DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR); + blitFlagsFromCompositionMode &= ~DSBLIT_BLEND_COLORALPHA; } else { - blitFlagsFromCompositionMode |= (DSBLIT_BLEND_COLORALPHA | DSBLIT_SRC_PREMULTCOLOR); + blitFlagsFromCompositionMode |= DSBLIT_BLEND_COLORALPHA; } } @@ -459,11 +458,14 @@ void QDirectFBPaintEnginePrivate::setRenderHints(QPainter::RenderHints hints) void QDirectFBPaintEnginePrivate::prepareForBlit(bool alpha) { quint32 blittingFlags = blitFlagsFromCompositionMode; - if (!alpha) { + if (alpha) { + surface->SetPorterDuff(surface, + (blittingFlags & DSBLIT_BLEND_COLORALPHA) + ? DSPD_NONE + : porterDuffRule); + } else { blittingFlags &= ~DSBLIT_BLEND_ALPHACHANNEL; surface->SetPorterDuff(surface, DSPD_NONE); - } else { - surface->SetPorterDuff(surface, porterDuffRule); } surface->SetColor(surface, 0xff, 0xff, 0xff, opacity); surface->SetBlittingFlags(surface, DFBSurfaceBlittingFlags(blittingFlags)); -- cgit v0.12