More work for integrating the new clipping code.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13186 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-06-16 18:58:14 +00:00
parent 5f8e562f04
commit 83265d84db
6 changed files with 47 additions and 13 deletions

View File

@ -21,7 +21,7 @@
//
// File Name: Layer.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Adi Oanca <adioanca@myrealbox.com>
// Adi Oanca <adioanca@cotty.iren.ro>
// Stephan Aßmus <superstippi@gmx.de>
// Description: Class used for rendering to the frame buffer. One layer per
// view on screen and also for window decorators
@ -197,8 +197,9 @@ Layer::AddChild(Layer* layer, ServerWindow* serverWin)
c->fServerWin=serverWin;
// 2.3) we are attached to the main tree so build our full region.
#ifndef NEW_CLIPPING
c->RebuildFullRegion();
#endif
// tree parsing algorithm
if (c->fTopChild) {
// go deep
@ -447,6 +448,7 @@ Layer::BottomChild() const
return fCurrent;
}
#ifndef NEW_CLIPPING
//! Rebuilds the layer's "completely visible" region
void
@ -836,6 +838,8 @@ Layer::ResizeOthers(float x, float y, BPoint coords[], BPoint *ptOffset)
return 0UL;
}
#endif
// Redraw
void
Layer::Redraw(const BRegion& reg, Layer *startFrom)
@ -898,7 +902,9 @@ Layer::Show(bool invalidate)
// NOTE: I added this here and it solves the invalid region problem
// for Windows that have been resized before they were shown. -Stephan
#ifndef NEW_CLIPPING
RebuildFullRegion();
#endif
SendViewCoordUpdateMsg();
if (invalidate)
@ -1321,15 +1327,19 @@ Layer::move_layer(float x, float y)
wb->fUpdateReg.OffsetBy(x, y);
}*/
#ifndef NEW_CLIPPING
BPoint pt(x, y);
BRect rect(fFull.Frame().OffsetByCopy(pt));
#endif
if (!fParent) {
printf("no parent in Layer::move_layer() (%s)\n", GetName());
fFrameAction = B_LAYER_ACTION_NONE;
return;
}
#ifndef NEW_CLIPPING
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt);
#endif
fDriver->CopyRegionList(&fRootLayer->fCopyRegList,
&fRootLayer->fCopyList,
@ -1351,7 +1361,10 @@ Layer::resize_layer(float x, float y)
{
fFrameAction = B_LAYER_ACTION_RESIZE;
#ifndef NEW_CLIPPING
BPoint pt(x,y);
#endif
BRect rect(fFull.Frame());
rect.right += x;
rect.bottom += y;
@ -1361,9 +1374,10 @@ printf("no parent in Layer::resize_layer() (%s)\n", GetName());
fFrameAction = B_LAYER_ACTION_NONE;
return;
}
#ifndef NEW_CLIPPING
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_RESIZE, pt);
#endif
fDriver->CopyRegionList(&fRootLayer->fCopyRegList, &fRootLayer->fCopyList, fRootLayer->fCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(fRootLayer->fRedrawReg, this);
@ -1392,9 +1406,11 @@ Layer::FullInvalidate(const BRegion& region)
printf("\n");
#endif
#ifndef NEW_CLIPPING
BPoint pt(0,0);
StartRebuildRegions(region, NULL,/* B_LAYER_INVALIDATE, pt); */B_LAYER_NONE, pt);
#endif
Redraw(fRootLayer->fRedrawReg);
EmptyGlobals();

View File

@ -94,7 +94,7 @@ class Layer {
const char* GetName() const
{ return (fName) ? fName->String() : NULL; }
#ifndef NEW_CLIPPING
virtual void RebuildFullRegion();
void StartRebuildRegions(const BRegion& reg,
Layer* target,
@ -109,7 +109,7 @@ class Layer {
uint32 ResizeOthers(float x, float y,
BPoint coords[],
BPoint* ptOffset);
#endif
void Redraw(const BRegion& reg,
Layer* startFrom = NULL);

View File

@ -226,7 +226,9 @@ RootLayer::WorkingThread(void *data)
// first make sure we are actualy visible
oneRootLayer->Lock();
#ifndef NEW_CLIPPING
oneRootLayer->RebuildFullRegion();
#endif
oneRootLayer->invalidate_layer(oneRootLayer, oneRootLayer->Bounds());
oneRootLayer->Unlock();

View File

@ -21,7 +21,7 @@
//
// File Name: ServerWindow.cpp
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Adi Oanca <adioanca@mymail.ro>
// Adi Oanca <adioanca@cotty.iren.ro>
// Stephan Aßmus <superstippi@gmx.de>
// Description: Shadow BWindow class
//
@ -519,7 +519,9 @@ ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
SetLayerState(fCurrentLayer, link);
// TODO: should this be moved into SetLayerState?
// If it _always_ needs to be done afterwards, then yes!
#ifndef NEW_CLIPPING
fCurrentLayer->RebuildFullRegion();
#endif
break;
}
case AS_LAYER_SET_FONT_STATE:
@ -527,7 +529,9 @@ ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
DTRACE(("ServerWindow %s: Message AS_LAYER_SET_FONT_STATE: Layer name: %s\n", fName, fCurrentLayer->fName->String()));
// SetLayerFontState(fCurrentLayer);
SetLayerFontState(fCurrentLayer, link);
#ifndef NEW_CLIPPING
fCurrentLayer->RebuildFullRegion();
#endif
break;
}
case AS_LAYER_GET_STATE:
@ -699,8 +703,9 @@ ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
DTRACE(("ServerWindow %s: Message AS_LAYER_PUSH_STATE: Layer: %s\n",fName, fCurrentLayer->fName->String()));
fCurrentLayer->PushState();
#ifndef NEW_CLIPPING
fCurrentLayer->RebuildFullRegion();
#endif
break;
}
case AS_LAYER_POP_STATE:
@ -708,8 +713,9 @@ ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
DTRACE(("ServerWindow %s: Message AS_LAYER_POP_STATE: Layer: %s\n",fName, fCurrentLayer->fName->String()));
fCurrentLayer->PopState();
#ifndef NEW_CLIPPING
fCurrentLayer->RebuildFullRegion();
#endif
break;
}
case AS_LAYER_SET_SCALE:
@ -893,7 +899,9 @@ ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
fCurrentLayer->fLayerData->SetClippingRegion(region);
#ifndef NEW_CLIPPING
fCurrentLayer->RebuildFullRegion();
#endif
if (!(fCurrentLayer->IsHidden()))
myRootLayer->GoInvalidate(fCurrentLayer, fCurrentLayer->fFull);
@ -960,7 +968,9 @@ ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
}
fCurrentLayer->fLayerData->SetClippingRegion(region);
#ifndef NEW_CLIPPING
fCurrentLayer->RebuildFullRegion();
#endif
if (!(fCurrentLayer->IsHidden()))
myRootLayer->GoInvalidate(fCurrentLayer, fCurrentLayer->fFull);

View File

@ -140,7 +140,9 @@ WinBorder::WinBorder(const BRect &r,
fDecorator->GetSizeLimits(&fMinWidth, &fMinHeight, &fMaxWidth, &fMaxHeight);
}
#ifndef NEW_CLIPPING
RebuildFullRegion();
#endif
gDesktop->AddWinBorder(this);
@ -283,6 +285,8 @@ y = (float)int32(y);
}
}
#ifndef NEW_CLIPPING
//! Rebuilds the WinBorder's "fully-visible" region based on info from the decorator
void
WinBorder::RebuildFullRegion()
@ -296,6 +300,8 @@ WinBorder::RebuildFullRegion()
fDecorator->GetFootprint(&fFull);
}
#endif
//! Sets the minimum and maximum sizes of the window
void
WinBorder::SetSizeLimits(float minWidth, float maxWidth,

View File

@ -21,7 +21,7 @@
//
// File Name: WinBorder.h
// Author: DarkWyrm <bpmagic@columbus.rr.com>
// Adi Oanca <adioanca@mymail.ro>
// Adi Oanca <adioanca@cotty.iren.ro>
// Stephan Aßmus <superstippi@gmx.de>
// Description: Layer subclass which handles window management
//
@ -83,9 +83,9 @@ class WinBorder : public Layer {
virtual void MoveBy(float x, float y);
virtual void ResizeBy(float x, float y);
#ifndef NEW_CLIPPING
virtual void RebuildFullRegion();
#endif
void SetSizeLimits(float minWidth,
float maxWidth,
float minHeight,