ShowPaint effect supports QPainter Compositing

This commit is contained in:
Martin Gräßlin 2013-06-21 14:23:36 +02:00
parent 79358541ea
commit 3776160bb7
2 changed files with 14 additions and 0 deletions

View file

@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <math.h>
#include <qcolor.h>
#include <QPainter>
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

View file

@ -37,6 +37,7 @@ public:
private:
void paintGL();
void paintXrender();
void paintQPainter();
QRegion painted; // what's painted in one pass
int color_index;
};