From a7e201435ff1f6b5d74ebee38387a0f8858ea05c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Axel=20D=C3=B6rfler?= Date: Fri, 9 Dec 2005 15:39:20 +0000 Subject: [PATCH] Now draws something again, it's just not updated on changes yet. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15448 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/servers/app/WorkspacesLayer.cpp | 25 +++++++++++++------------ src/servers/app/WorkspacesLayer.h | 3 ++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/servers/app/WorkspacesLayer.cpp b/src/servers/app/WorkspacesLayer.cpp index a8e1a9933c..7a8b7057ad 100644 --- a/src/servers/app/WorkspacesLayer.cpp +++ b/src/servers/app/WorkspacesLayer.cpp @@ -171,7 +171,8 @@ WorkspacesLayer::_DrawWindow(DrawingEngine* drawingEngine, const BRect& workspac void -WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine, int32 index) +WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine, + BRegion& redraw, int32 index) { BRect rect = _WorkspaceAt(index); @@ -191,7 +192,7 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine, int32 index) // draw windows - BRegion backgroundRegion = fLocalClipping; + BRegion backgroundRegion = redraw; // ToDo: would be nice to get the real update region here @@ -218,9 +219,7 @@ WorkspacesLayer::_DrawWorkspace(DrawingEngine* drawingEngine, int32 index) drawingEngine->ConstrainClippingRegion(&backgroundRegion); drawingEngine->FillRect(rect, color); - // TODO: ConstrainClippingRegion() should accept a const parameter !! - BRegion cRegion(fLocalClipping); - drawingEngine->ConstrainClippingRegion(&cRegion); + drawingEngine->ConstrainClippingRegion(&redraw); } @@ -235,6 +234,11 @@ void WorkspacesLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, BRegion* windowContentClipping, bool deep) { + // we can only draw within our own area + BRegion redraw(ScreenClipping(windowContentClipping)); + // add the current clipping + redraw.IntersectWith(effectiveClipping); + int32 columns, rows; _GetGrid(columns, rows); @@ -243,14 +247,12 @@ WorkspacesLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, // make sure the grid around the active workspace is not drawn // to reduce flicker BRect activeRect = _WorkspaceAt(Window()->Desktop()->CurrentWorkspace()); - BRegion gridRegion(fLocalClipping); + BRegion gridRegion(redraw); gridRegion.Exclude(activeRect); drawingEngine->ConstrainClippingRegion(&gridRegion); BRect frame = Frame(); - BPoint pt(0,0); - ConvertToScreen(&pt); - frame.OffsetBy(pt); + // top ViewLayer frame is in screen coordinates // horizontal lines @@ -274,13 +276,12 @@ WorkspacesLayer::Draw(DrawingEngine* drawingEngine, BRegion* effectiveClipping, BPoint(rect.right, frame.bottom), ViewColor()); } - BRegion cRegion(fLocalClipping); - drawingEngine->ConstrainClippingRegion(&cRegion); + drawingEngine->ConstrainClippingRegion(&redraw); // draw workspaces for (int32 i = rows * columns; i-- > 0;) { - _DrawWorkspace(drawingEngine, i); + _DrawWorkspace(drawingEngine, redraw, i); } } diff --git a/src/servers/app/WorkspacesLayer.h b/src/servers/app/WorkspacesLayer.h index 24a4e8887d..c7b5778928 100644 --- a/src/servers/app/WorkspacesLayer.h +++ b/src/servers/app/WorkspacesLayer.h @@ -37,7 +37,8 @@ class WorkspacesLayer : public ViewLayer { const BRect& screenFrame, WindowLayer* window, BPoint windowPosition, BRegion& backgroundRegion, bool active); - void _DrawWorkspace(DrawingEngine* drawingEngine, int32 index); + void _DrawWorkspace(DrawingEngine* drawingEngine, BRegion& redraw, + int32 index); void _DarkenColor(RGBColor& color) const; };