From fc5e74f4e2b951057ddd7b7cd773bf7e45e4f864 Mon Sep 17 00:00:00 2001 From: Philipp Knechtges Date: Fri, 15 Jul 2011 10:27:11 +0200 Subject: [PATCH] kwin: make decoration repaints window-specific This gives the new Scene::paintSimpleScreen more room for optimizations. --- client.cpp | 5 +++-- composite.cpp | 8 ++++++++ toplevel.h | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/client.cpp b/client.cpp index 5ed36a9d5d..f07369135d 100644 --- a/client.cpp +++ b/client.cpp @@ -500,8 +500,9 @@ void Client::repaintDecorationPending() // The scene will update the decoration pixmaps in the next painting pass // if it has not been already repainted before const QRegion r = paintRedirector->scheduledRepaintRegion(); - if (!r.isEmpty()) - Workspace::self()->addRepaint(r.translated(x() - padding_left, y() - padding_top)); + if (!r.isEmpty()) { + addRepaint(r.translated(-padding_left,-padding_top)); + } } } diff --git a/composite.cpp b/composite.cpp index 43078fb7d6..fe76957196 100644 --- a/composite.cpp +++ b/composite.cpp @@ -748,6 +748,14 @@ void Toplevel::addRepaint(int x, int y, int w, int h) workspace()->checkCompositeTimer(); } +void Toplevel::addRepaint(const QRegion& r) +{ + if (!compositing()) + return; + repaints_region += r; + workspace()->checkCompositeTimer(); +} + void Toplevel::addRepaintFull() { repaints_region = decorationRect(); diff --git a/toplevel.h b/toplevel.h index 9ad7dbaa78..fb6712b272 100644 --- a/toplevel.h +++ b/toplevel.h @@ -124,6 +124,7 @@ public: bool unredirected() const; void suspendUnredirect(bool suspend); void addRepaint(const QRect& r); + void addRepaint(const QRegion& r); void addRepaint(int x, int y, int w, int h); virtual void addRepaintFull(); // these call workspace->addRepaint(), but first transform the damage if needed