prePaintWindow() calls of effects are now all done before anything is rendered. This is necessary e.g. for
upcoming blur effect. Also postPaintScreen() is now called after postPaintWindow() calls. svn path=/branches/work/kwin_composite/; revision=658757
This commit is contained in:
parent
6e62dcb922
commit
e85930ce1e
1 changed files with 16 additions and 8 deletions
24
scene.cpp
24
scene.cpp
|
@ -114,9 +114,9 @@ void Scene::paintScreen( int* mask, QRegion* region )
|
||||||
paintBackground( *region );
|
paintBackground( *region );
|
||||||
ScreenPaintData data;
|
ScreenPaintData data;
|
||||||
effects->paintScreen( *mask, *region, data );
|
effects->paintScreen( *mask, *region, data );
|
||||||
effects->postPaintScreen();
|
|
||||||
foreach( Window* w, stacking_order )
|
foreach( Window* w, stacking_order )
|
||||||
effects->postPaintWindow( effectWindow( w ));
|
effects->postPaintWindow( effectWindow( w ));
|
||||||
|
effects->postPaintScreen();
|
||||||
*region |= painted_region;
|
*region |= painted_region;
|
||||||
// make sure not to go outside of the screen area
|
// make sure not to go outside of the screen area
|
||||||
*region &= QRegion( 0, 0, displayWidth(), displayHeight());
|
*region &= QRegion( 0, 0, displayWidth(), displayHeight());
|
||||||
|
@ -162,6 +162,7 @@ void Scene::paintGenericScreen( int orig_mask, ScreenPaintData )
|
||||||
{
|
{
|
||||||
if( !( orig_mask & PAINT_SCREEN_BACKGROUND_FIRST ))
|
if( !( orig_mask & PAINT_SCREEN_BACKGROUND_FIRST ))
|
||||||
paintBackground( infiniteRegion());
|
paintBackground( infiniteRegion());
|
||||||
|
QList< Phase2Data > phase2;
|
||||||
foreach( Window* w, stacking_order ) // bottom to top
|
foreach( Window* w, stacking_order ) // bottom to top
|
||||||
{
|
{
|
||||||
int mask = orig_mask | ( w->isOpaque() ? PAINT_WINDOW_OPAQUE : PAINT_WINDOW_TRANSLUCENT );
|
int mask = orig_mask | ( w->isOpaque() ? PAINT_WINDOW_OPAQUE : PAINT_WINDOW_TRANSLUCENT );
|
||||||
|
@ -172,8 +173,11 @@ void Scene::paintGenericScreen( int orig_mask, ScreenPaintData )
|
||||||
effects->prePaintWindow( effectWindow( w ), &mask, &paint, &clip, time_diff );
|
effects->prePaintWindow( effectWindow( w ), &mask, &paint, &clip, time_diff );
|
||||||
if( !w->isPaintingEnabled())
|
if( !w->isPaintingEnabled())
|
||||||
continue;
|
continue;
|
||||||
paintWindow( w, mask, infiniteRegion());
|
phase2.append( Phase2Data( w, infiniteRegion(), mask ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach( Phase2Data d, phase2 )
|
||||||
|
paintWindow( d.window, d.mask, d.region );
|
||||||
}
|
}
|
||||||
|
|
||||||
// The optimized case without any transformations at all.
|
// The optimized case without any transformations at all.
|
||||||
|
@ -185,7 +189,8 @@ void Scene::paintSimpleScreen( int orig_mask, QRegion region )
|
||||||
// perhaps the two enums should be separated
|
// perhaps the two enums should be separated
|
||||||
assert(( orig_mask & ( PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED
|
assert(( orig_mask & ( PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED
|
||||||
| PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_OPAQUE )) == 0 );
|
| PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_OPAQUE )) == 0 );
|
||||||
QList< Phase2Data > phase2;
|
QList< Phase2Data > phase2opaque;
|
||||||
|
QList< Phase2Data > phase2translucent;
|
||||||
QRegion allclips;
|
QRegion allclips;
|
||||||
// Draw each opaque window top to bottom, subtracting the bounding rect of
|
// Draw each opaque window top to bottom, subtracting the bounding rect of
|
||||||
// each window from the clip region after it's been drawn.
|
// each window from the clip region after it's been drawn.
|
||||||
|
@ -213,25 +218,28 @@ void Scene::paintSimpleScreen( int orig_mask, QRegion region )
|
||||||
// If the window is transparent, the transparent part will be done
|
// If the window is transparent, the transparent part will be done
|
||||||
// in the 2nd pass.
|
// in the 2nd pass.
|
||||||
if( mask & PAINT_WINDOW_TRANSLUCENT )
|
if( mask & PAINT_WINDOW_TRANSLUCENT )
|
||||||
phase2.prepend( Phase2Data( w, paint, mask ));
|
phase2translucent.prepend( Phase2Data( w, paint, mask ));
|
||||||
if( mask & PAINT_WINDOW_OPAQUE )
|
if( mask & PAINT_WINDOW_OPAQUE )
|
||||||
{
|
{
|
||||||
paintWindow( w, mask, paint );
|
phase2opaque.append( Phase2Data( w, paint, mask ));
|
||||||
// The window can clip by its opaque parts the windows below.
|
// The window can clip by its opaque parts the windows below.
|
||||||
region -= clip;
|
region -= clip;
|
||||||
allclips |= clip;
|
allclips |= clip;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Do the actual painting
|
||||||
|
// First opaque windows, top to bottom
|
||||||
|
foreach( Phase2Data d, phase2opaque )
|
||||||
|
paintWindow( d.window, d.mask, d.region );
|
||||||
if( !( orig_mask & PAINT_SCREEN_BACKGROUND_FIRST ))
|
if( !( orig_mask & PAINT_SCREEN_BACKGROUND_FIRST ))
|
||||||
paintBackground( region ); // Fill any areas of the root window not covered by windows
|
paintBackground( region ); // Fill any areas of the root window not covered by windows
|
||||||
// Now walk the list bottom to top, drawing translucent windows.
|
// Now walk the list bottom to top, drawing translucent windows.
|
||||||
// That we draw bottom to top is important now since we're drawing translucent objects
|
// That we draw bottom to top is important now since we're drawing translucent objects
|
||||||
// and also are clipping only by opaque windows.
|
// and also are clipping only by opaque windows.
|
||||||
QRegion add_paint;
|
QRegion add_paint;
|
||||||
foreach( Phase2Data d, phase2 )
|
foreach( Phase2Data d, phase2translucent )
|
||||||
{
|
{
|
||||||
Window* w = d.window;
|
paintWindow( d.window, d.mask, d.region | add_paint );
|
||||||
paintWindow( w, d.mask, d.region | add_paint );
|
|
||||||
// It is necessary to also add paint regions of windows below, because their
|
// It is necessary to also add paint regions of windows below, because their
|
||||||
// pre-paint's might have extended the paint area, so those areas need to be painted too.
|
// pre-paint's might have extended the paint area, so those areas need to be painted too.
|
||||||
add_paint |= d.region;
|
add_paint |= d.region;
|
||||||
|
|
Loading…
Reference in a new issue