From 023ebc47b1e3f1fcd953216c88fd40b81828d756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 19 Jul 2007 15:55:04 +0000 Subject: [PATCH] Implement smoothNeeded() - window quads need smoothing if width or height of some of them has changed. svn path=/trunk/KDE/kdebase/workspace/; revision=689942 --- lib/kwineffects.cpp | 14 +++++++++++++- lib/kwineffects.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/kwineffects.cpp b/lib/kwineffects.cpp index 311f64018f..94874b256c 100644 --- a/lib/kwineffects.cpp +++ b/lib/kwineffects.cpp @@ -355,6 +355,15 @@ WindowQuad WindowQuad::makeSubQuad( float x1, float y1, float x2, float y2 ) con return ret; } +bool WindowQuad::smoothNeeded() const + { + // smoothing is needed if the width or height of the quad does not match the original size + float width = verts[ 1 ].ox - verts[ 0 ].ox; + float height = verts[ 2 ].oy - verts[ 1 ].oy; + return( verts[ 1 ].px - verts[ 0 ].px != width || verts[ 2 ].px - verts[ 3 ].px != width + || verts[ 2 ].py - verts[ 1 ].py != height || verts[ 3 ].py - verts[ 0 ].py != height ); + } + /*************************************************************** WindowQuadList ***************************************************************/ @@ -510,7 +519,10 @@ WindowQuadList WindowQuadList::filterOut( WindowQuadType type ) const bool WindowQuadList::smoothNeeded() const { - return false; // TODO + foreach( WindowQuad q, *this ) + if( q.smoothNeeded()) + return true; + return false; } } // namespace diff --git a/lib/kwineffects.h b/lib/kwineffects.h index 8116ea6efe..6f96a08a85 100644 --- a/lib/kwineffects.h +++ b/lib/kwineffects.h @@ -409,6 +409,7 @@ class KWIN_EXPORT WindowQuad float originalRight() const; float originalTop() const; float originalBottom() const; + bool smoothNeeded() const; private: friend class WindowQuadList; void checkUntransformed() const;