From 2dc14be6401954669614ce00e6e22026e5ff549d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Fri, 21 Jun 2013 15:52:44 +0200 Subject: [PATCH] MouseClick Animation effect supports QPainter Compositor --- effects/mouseclick/mouseclick.cpp | 13 +++++++++++++ effects/mouseclick/mouseclick.h | 1 + 2 files changed, 14 insertions(+) diff --git a/effects/mouseclick/mouseclick.cpp b/effects/mouseclick/mouseclick.cpp index a888045c1a..22b28e7db8 100644 --- a/effects/mouseclick/mouseclick.cpp +++ b/effects/mouseclick/mouseclick.cpp @@ -34,6 +34,8 @@ along with this program. If not, see . #include #include +#include + #include namespace KWin @@ -254,6 +256,8 @@ void MouseClickEffect::drawCircle(const QColor& color, float cx, float cy, float drawCircleGl(color, cx, cy, r); if (effects->compositingType() == XRenderCompositing) drawCircleXr(color, cx, cy, r); + if (effects->compositingType() == QPainterCompositing) + drawCircleQPainter(color, cx, cy, r); } void MouseClickEffect::paintScreenSetup(int mask, QRegion region, ScreenPaintData& data) @@ -357,6 +361,15 @@ void MouseClickEffect::drawCircleXr(const QColor& color, float cx, float cy, flo #endif } +void MouseClickEffect::drawCircleQPainter(const QColor &color, float cx, float cy, float r) +{ + QPainter *painter = effects->scenePainter(); + painter->save(); + painter->setPen(color); + painter->drawArc(cx - r, cy - r, r * 2, r * 2, 0, 5760); + painter->restore(); +} + void MouseClickEffect::paintScreenSetupGl(int, QRegion, ScreenPaintData&) { if (ShaderManager::instance()->isValid()) { diff --git a/effects/mouseclick/mouseclick.h b/effects/mouseclick/mouseclick.h index b57865c324..40cddeb4c9 100644 --- a/effects/mouseclick/mouseclick.h +++ b/effects/mouseclick/mouseclick.h @@ -160,6 +160,7 @@ private: void drawCircleGl(const QColor& color, float cx, float cy, float r); void drawCircleXr(const QColor& color, float cx, float cy, float r); + void drawCircleQPainter(const QColor& color, float cx, float cy, float r); void paintScreenSetupGl(int mask, QRegion region, ScreenPaintData& data); void paintScreenFinishGl(int mask, QRegion region, ScreenPaintData& data);