From a1d0e588b9d8e4a479a0bc9218dae47fa14fdcd4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Thu, 1 Dec 2005 10:41:01 +0000 Subject: [PATCH] Another use of clipping regions to eliminate flickering. Maybe I have to come up with something better though, when the window titles are drawn as well... git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15259 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/WorkspacesLayer.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/servers/app/WorkspacesLayer.cpp b/src/servers/app/WorkspacesLayer.cpp index 5f5408258a..0bef6ba778 100644 --- a/src/servers/app/WorkspacesLayer.cpp +++ b/src/servers/app/WorkspacesLayer.cpp @@ -205,19 +205,25 @@ WorkspacesLayer::_DarkenColor(RGBColor& color) const void WorkspacesLayer::Draw(const BRect& updateRect) { - // ToDo: either draw into an off-screen bitmap, or turn off flickering... - int32 columns, rows; _GetGrid(columns, rows); // draw grid - // horizontal lines + + // make sure the grid around the active workspace is not drawn + // to reduce flicker + BRect activeRect = _WorkspaceAt(Window()->Desktop()->CurrentWorkspace()); + BRegion gridRegion(VisibleRegion()); + gridRegion.Exclude(activeRect); + GetDrawingEngine()->ConstrainClippingRegion(&gridRegion); BRect frame = Frame(); BPoint pt(0,0); ConvertToScreen(&pt); frame.OffsetBy(pt); + // horizontal lines + GetDrawingEngine()->StrokeLine(BPoint(frame.left, frame.top), BPoint(frame.right, frame.top), ViewColor()); @@ -238,6 +244,9 @@ WorkspacesLayer::Draw(const BRect& updateRect) BPoint(rect.right, frame.bottom), ViewColor()); } + BRegion cRegion(VisibleRegion()); + GetDrawingEngine()->ConstrainClippingRegion(&cRegion); + // draw workspaces for (int32 i = rows * columns; i-- > 0;) {