From 3776160bb747d1e2b5b139c171619f49a4980a1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 21 Jun 2013 14:23:36 +0200 Subject: [PATCH] ShowPaint effect supports QPainter Compositing --- effects/showpaint/showpaint.cpp | 13 +++++++++++++ effects/showpaint/showpaint.h | 1 + 2 files changed, 14 insertions(+) diff --git a/effects/showpaint/showpaint.cpp b/effects/showpaint/showpaint.cpp index 9de4649dbb..5a7a044a21 100644 --- a/effects/showpaint/showpaint.cpp +++ b/effects/showpaint/showpaint.cpp @@ -31,6 +31,7 @@ along with this program. If not, see . #include #include +#include namespace KWin { @@ -60,6 +61,9 @@ void ShowPaintEffect::paintScreen(int mask, QRegion region, ScreenPaintData& dat if (effects->compositingType() == XRenderCompositing) paintXrender(); #endif + if (effects->compositingType() == QPainterCompositing) { + paintQPainter(); + } if (++color_index == sizeof(colors) / sizeof(colors[ 0 ])) color_index = 0; } @@ -115,4 +119,13 @@ void ShowPaintEffect::paintXrender() #endif } +void ShowPaintEffect::paintQPainter() +{ + QColor color = colors[ color_index ]; + color.setAlphaF(0.2); + foreach (const QRect & r, painted.rects()) { + effects->scenePainter()->fillRect(r, color); + } +} + } // namespace diff --git a/effects/showpaint/showpaint.h b/effects/showpaint/showpaint.h index 83c48390ef..7765f5fc52 100644 --- a/effects/showpaint/showpaint.h +++ b/effects/showpaint/showpaint.h @@ -37,6 +37,7 @@ public: private: void paintGL(); void paintXrender(); + void paintQPainter(); QRegion painted; // what's painted in one pass int color_index; };