From cb9cbae36e19f0ca529c490142050a3608aeec90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Tue, 11 Nov 2014 09:39:45 +0100 Subject: [PATCH] Decoration::paint takes the repaint region --- clients/aurorae/src/aurorae.cpp | 3 ++- clients/aurorae/src/aurorae.h | 2 +- decorations/decorationrenderer.cpp | 2 +- kcmkwin/kwindecoration/declarative-plugin/previewbutton.cpp | 3 +-- kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp | 2 +- scene_qpainter.cpp | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/clients/aurorae/src/aurorae.cpp b/clients/aurorae/src/aurorae.cpp index 4f61e3bbc8..84aeb51304 100644 --- a/clients/aurorae/src/aurorae.cpp +++ b/clients/aurorae/src/aurorae.cpp @@ -391,8 +391,9 @@ void Decoration::updateBorders() setBorders(b->left(), b->right(), b->top(), b->bottom()); } -void Decoration::paint(QPainter *painter) +void Decoration::paint(QPainter *painter, const QRegion &repaintRegion) { + Q_UNUSED(repaintRegion) if (!settings()->isAlphaChannelSupported()) { return; } diff --git a/clients/aurorae/src/aurorae.h b/clients/aurorae/src/aurorae.h index ff53281c5b..462faa8510 100644 --- a/clients/aurorae/src/aurorae.h +++ b/clients/aurorae/src/aurorae.h @@ -44,7 +44,7 @@ public: explicit Decoration(QObject *parent = nullptr, const QVariantList &args = QVariantList()); virtual ~Decoration(); - void paint(QPainter *painter) override; + void paint(QPainter *painter, const QRegion &repaintRegion) override; Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant()); diff --git a/decorations/decorationrenderer.cpp b/decorations/decorationrenderer.cpp index 6019a1392d..c4655e04ae 100644 --- a/decorations/decorationrenderer.cpp +++ b/decorations/decorationrenderer.cpp @@ -71,7 +71,7 @@ QImage Renderer::renderToImage(const QRect &geo) p.setRenderHint(QPainter::Antialiasing); p.setWindow(geo); p.setClipRect(geo); - client()->decoration()->paint(&p); + client()->decoration()->paint(&p, geo); return image; } diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewbutton.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewbutton.cpp index b69761517e..d3dd990c2b 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewbutton.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewbutton.cpp @@ -128,11 +128,10 @@ void PreviewButtonItem::syncGeometry() void PreviewButtonItem::paint(QPainter *painter) { - Q_UNUSED(painter) if (!m_button) { return; } - m_button->paint(painter); + m_button->paint(painter, QRegion(0, 0, width(), height())); } } diff --git a/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp b/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp index 105031a9b1..dc8c7b04bd 100644 --- a/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp +++ b/kcmkwin/kwindecoration/declarative-plugin/previewitem.cpp @@ -154,7 +154,7 @@ void PreviewItem::paint(QPainter *painter) int paddingRight = 0; int paddingBottom = 0; paintShadow(painter, paddingLeft, paddingRight, paddingTop, paddingBottom); - m_decoration->paint(painter); + m_decoration->paint(painter, QRegion(0, 0, width(), height())); if (m_drawBackground) { painter->fillRect(m_decoration->borderLeft(), m_decoration->borderTop(), width() - m_decoration->borderLeft() - m_decoration->borderRight() - paddingLeft - paddingRight, diff --git a/scene_qpainter.cpp b/scene_qpainter.cpp index 1e97ffd980..550547bea9 100644 --- a/scene_qpainter.cpp +++ b/scene_qpainter.cpp @@ -646,7 +646,7 @@ void SceneQPainterDecorationRenderer::render() painter.setCompositionMode(QPainter::CompositionMode_Source); painter.fillRect(rect, Qt::red); painter.restore(); - client()->decoration()->paint(&painter); + client()->decoration()->paint(&painter, rect); }; renderPart(left.intersected(geometry), left, int(DecorationPart::Left));