More checks that quads are split only in pre-paint and transformed
only in paint. svn path=/trunk/KDE/kdebase/workspace/; revision=689945
This commit is contained in:
parent
023ebc47b1
commit
56eeb84acc
4 changed files with 41 additions and 14 deletions
|
@ -316,7 +316,10 @@ EffectWindowGroup::~EffectWindowGroup()
|
|||
WindowQuad WindowQuad::makeSubQuad( float x1, float y1, float x2, float y2 ) const
|
||||
{
|
||||
assert( x1 < x2 && y1 < y2 && x1 >= left() && x2 <= right() && y1 >= top() && y2 <= bottom());
|
||||
checkUntransformed();
|
||||
#ifndef NDEBUG
|
||||
if( isTransformed())
|
||||
kFatal( 1212 ) << "Splitting quads is allowed only in pre-paint calls!" << endl;
|
||||
#endif
|
||||
WindowQuad ret( *this );
|
||||
// vertices are clockwise starting from topleft
|
||||
ret.verts[ 0 ].px = x1;
|
||||
|
@ -373,6 +376,10 @@ WindowQuadList WindowQuadList::splitAtX( float x ) const
|
|||
WindowQuadList ret;
|
||||
foreach( WindowQuad quad, *this )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if( quad.isTransformed())
|
||||
kFatal( 1212 ) << "Splitting quads is allowed only in pre-paint calls!" << endl;
|
||||
#endif
|
||||
bool wholeleft = true;
|
||||
bool wholeright = true;
|
||||
for( int i = 0;
|
||||
|
@ -400,6 +407,10 @@ WindowQuadList WindowQuadList::splitAtY( float y ) const
|
|||
WindowQuadList ret;
|
||||
foreach( WindowQuad quad, *this )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if( quad.isTransformed())
|
||||
kFatal( 1212 ) << "Splitting quads is allowed only in pre-paint calls!" << endl;
|
||||
#endif
|
||||
bool wholetop = true;
|
||||
bool wholebottom = true;
|
||||
for( int i = 0;
|
||||
|
@ -433,6 +444,10 @@ WindowQuadList WindowQuadList::makeGrid( int maxquadsize ) const
|
|||
float bottom = first().bottom();
|
||||
foreach( WindowQuad quad, *this )
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
if( quad.isTransformed())
|
||||
kFatal( 1212 ) << "Splitting quads is allowed only in pre-paint calls!" << endl;
|
||||
#endif
|
||||
left = qMin( left, quad.left());
|
||||
right = qMax( right, quad.right());
|
||||
top = qMin( top, quad.top());
|
||||
|
|
|
@ -400,7 +400,6 @@ class KWIN_EXPORT WindowQuad
|
|||
WindowVertex& operator[]( int index );
|
||||
const WindowVertex& operator[]( int index ) const;
|
||||
bool decoration() const;
|
||||
// these 8 work only with untransformed quads
|
||||
float left() const;
|
||||
float right() const;
|
||||
float top() const;
|
||||
|
@ -410,9 +409,9 @@ class KWIN_EXPORT WindowQuad
|
|||
float originalTop() const;
|
||||
float originalBottom() const;
|
||||
bool smoothNeeded() const;
|
||||
bool isTransformed() const;
|
||||
private:
|
||||
friend class WindowQuadList;
|
||||
void checkUntransformed() const;
|
||||
WindowVertex verts[ 4 ];
|
||||
WindowQuadType type; // 0 - contents, 1 - decoration
|
||||
};
|
||||
|
@ -590,38 +589,36 @@ bool WindowQuad::decoration() const
|
|||
}
|
||||
|
||||
inline
|
||||
void WindowQuad::checkUntransformed() const
|
||||
bool WindowQuad::isTransformed() const
|
||||
{
|
||||
assert( verts[ 0 ].py == verts[ 1 ].py && verts[ 2 ].py == verts[ 3 ].py
|
||||
&& verts[ 0 ].px == verts[ 3 ].px && verts[ 1 ].px == verts[ 2 ].px );
|
||||
return !( verts[ 0 ].px == verts[ 0 ].ox && verts[ 0 ].py == verts[ 0 ].oy
|
||||
&& verts[ 1 ].px == verts[ 1 ].ox && verts[ 1 ].py == verts[ 1 ].oy
|
||||
&& verts[ 2 ].px == verts[ 2 ].ox && verts[ 2 ].py == verts[ 2 ].oy
|
||||
&& verts[ 3 ].px == verts[ 3 ].ox && verts[ 3 ].py == verts[ 3 ].oy );
|
||||
}
|
||||
|
||||
inline
|
||||
float WindowQuad::left() const
|
||||
{
|
||||
checkUntransformed();
|
||||
return verts[ 0 ].px;
|
||||
return qMin( verts[ 0 ].px, qMin( verts[ 1 ].px, qMin( verts[ 2 ].px, verts[ 3 ].px )));
|
||||
}
|
||||
|
||||
inline
|
||||
float WindowQuad::right() const
|
||||
{
|
||||
checkUntransformed();
|
||||
return verts[ 2 ].px;
|
||||
return qMax( verts[ 0 ].px, qMax( verts[ 1 ].px, qMax( verts[ 2 ].px, verts[ 3 ].px )));
|
||||
}
|
||||
|
||||
inline
|
||||
float WindowQuad::top() const
|
||||
{
|
||||
checkUntransformed();
|
||||
return verts[ 0 ].py;
|
||||
return qMin( verts[ 0 ].py, qMin( verts[ 1 ].py, qMin( verts[ 2 ].py, verts[ 3 ].py )));
|
||||
}
|
||||
|
||||
inline
|
||||
float WindowQuad::bottom() const
|
||||
{
|
||||
checkUntransformed();
|
||||
return verts[ 2 ].py;
|
||||
return qMax( verts[ 0 ].py, qMax( verts[ 1 ].py, qMax( verts[ 2 ].py, verts[ 3 ].py )));
|
||||
}
|
||||
|
||||
inline
|
||||
|
|
10
scene.cpp
10
scene.cpp
|
@ -178,6 +178,11 @@ void Scene::paintGenericScreen( int orig_mask, ScreenPaintData )
|
|||
data.quads = w->buildQuads();
|
||||
// preparation step
|
||||
effects->prePaintWindow( effectWindow( w ), data, time_diff );
|
||||
#ifndef NDEBUG
|
||||
foreach( WindowQuad q, data.quads )
|
||||
if( q.isTransformed())
|
||||
kFatal( 1212 ) << "Pre-paint calls are not allowed to transform quads!" << endl;
|
||||
#endif
|
||||
if( !w->isPaintingEnabled())
|
||||
continue;
|
||||
phase2.append( Phase2Data( w, infiniteRegion(), data.mask, data.quads ));
|
||||
|
@ -214,6 +219,11 @@ void Scene::paintSimpleScreen( int orig_mask, QRegion region )
|
|||
data.quads = w->buildQuads();
|
||||
// preparation step
|
||||
effects->prePaintWindow( effectWindow( w ), data, time_diff );
|
||||
#ifndef NDEBUG
|
||||
foreach( WindowQuad q, data.quads )
|
||||
if( q.isTransformed())
|
||||
kFatal( 1212 ) << "Pre-paint calls are not allowed to transform quads!" << endl;
|
||||
#endif
|
||||
if( !w->isPaintingEnabled())
|
||||
continue;
|
||||
data.paint -= allclips; // make sure to avoid already clipped areas
|
||||
|
|
|
@ -214,6 +214,11 @@ void SceneXrender::paintTransformedScreen( int orig_mask )
|
|||
data.quads = w->buildQuads();
|
||||
// preparation step
|
||||
effects->prePaintWindow( effectWindow( w ), data, time_diff );
|
||||
#ifndef NDEBUG
|
||||
foreach( WindowQuad q, data.quads )
|
||||
if( q.isTransformed())
|
||||
kFatal( 1212 ) << "Pre-paint calls are not allowed to transform quads!" << endl;
|
||||
#endif
|
||||
if( !w->isPaintingEnabled())
|
||||
continue;
|
||||
data.paint -= allclips; // make sure to avoid already clipped areas
|
||||
|
|
Loading…
Reference in a new issue