Adding a new rendering flag for painting the screen with transformed windows but without triggering full repaints.

It is not always required to do a full repaint in each frame. E.g. in sliding popups the repaint areas are known and tracked.
This change reduces the painting overhead to just the window area.
Nevertheless I consider this change as experimental and will revert the commit in case it introduces rendering glitches.
Other effects which are good candidates for this flag is wobbly windows, magic lamp, minimize or in general all effects which transform just one window.

svn path=/trunk/KDE/kdebase/workspace/; revision=1158838
This commit is contained in:
Martin Gräßlin 2010-08-03 21:33:27 +00:00
parent 74f2006855
commit 6e31461039
4 changed files with 17 additions and 4 deletions

View file

@ -48,7 +48,7 @@ SlidingPopupsEffect::~SlidingPopupsEffect()
void SlidingPopupsEffect::prePaintScreen( ScreenPrePaintData& data, int time )
{
if( !mAppearingWindows.isEmpty() || !mDisappearingWindows.isEmpty() )
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS;
data.mask |= PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS;
effects->prePaintScreen( data, time );
}

View file

@ -311,7 +311,16 @@ class KWIN_EXPORT Effect
/**
* Window will be painted with a lanczos filter.
**/
PAINT_WINDOW_LANCZOS = 1 << 8
PAINT_WINDOW_LANCZOS = 1 << 8,
/**
* Same as PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS but does not trigger
* full repaints of the screen. If this flag is used the effect has
* to ensure by itself that the correct areas are repainted. If not
* handled correctly it will cause rendering glitches.
* Use with care!
* @since 4.6
**/
PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9
};
/**

View file

@ -173,7 +173,8 @@ void Scene::idle()
// the function that'll be eventually called by paintScreen() above
void Scene::finalPaintScreen( int mask, QRegion region, ScreenPaintData& data )
{
if( mask & ( PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS ))
if( mask & ( PAINT_SCREEN_TRANSFORMED | PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS
| PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS ))
paintGenericScreen( mask, data );
else
paintSimpleScreen( mask, region );
@ -222,6 +223,7 @@ void Scene::paintSimpleScreen( int orig_mask, QRegion region )
// perhaps the two enums should be separated
assert(( orig_mask & ( PAINT_WINDOW_TRANSFORMED | PAINT_SCREEN_TRANSFORMED
| PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS
| PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS
| PAINT_WINDOW_TRANSLUCENT | PAINT_WINDOW_OPAQUE )) == 0 );
QHash< Window*, Phase2Data > phase2data;
// Draw each opaque window top to bottom, subtracting the bounding rect of

View file

@ -86,7 +86,9 @@ class Scene
// Temporary solution since (_OPAQUE | _TRANSLUCENT) is not working currently.
PAINT_DECORATION_ONLY = 1 << 7,
// Window will be painted with a lanczos filter.
PAINT_WINDOW_LANCZOS = 1 << 8
PAINT_WINDOW_LANCZOS = 1 << 8,
// same as PAINT_SCREEN_TRANSFORMED without full repainting
PAINT_SCREEN_WITH_TRANSFORMED_WINDOWS_WITHOUT_FULL_REPAINTS = 1 << 9
};
// types of filtering available
enum ImageFilterType { ImageFilterFast, ImageFilterGood };