This is it. Update code is ready. At leat I think so. Testing is next. Uh, didn't thought this could be this easy. :-)

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8320 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2004-07-05 20:37:13 +00:00
parent 427dd22b3d
commit 16039b760a
3 changed files with 37 additions and 3 deletions

View File

@ -77,6 +77,7 @@ Layer::Layer(BRect frame, const char *name, int32 token, uint32 resize,
clipToPicture = NULL;
// NOW all regions (fVisible, fFullVisible, fFull) are empty
fClipReg = &fVisible;
STRACE(("Layer(%s) successfuly created\n", GetName()));
}
@ -509,8 +510,14 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
// Update one.
BRegion common(lay->fFullVisible);
common.IntersectWith(&reg);
if (common.CountRects() > 0)
if (common.CountRects() > 0){
// lock/unlock if we are a winborder
if (lay->fClassID == AS_WINBORDER_CLASS)
lay->Window()->Lock();
lay->RequestDraw(reg, NULL);
if (lay->fClassID == AS_WINBORDER_CLASS)
lay->Window()->Unlock();
}
}
}
}
@ -533,6 +540,21 @@ r.PrintToStream();
// empty HOOK function.
}
void Layer::UpdateStart()
{
// durring update we are not allowed to draw outside the update region.
// why should we? we only need that region redrawn!
fInUpdate = true;
fClipReg = &fUpdateReg;
}
void Layer::UpdateEnd()
{
// the usual case. Drawing is permited in the whole visible area.
fInUpdate = false;
fClipReg = &fVisible;
fUpdateReg.MakeEmpty();
}
void Layer::Show(bool invalidate)
{

View File

@ -114,9 +114,10 @@ public:
void SetAsTopLayer(bool option) { fIsTopLayer = option; }
bool IsTopLayer() const { return fIsTopLayer; }
void UpdateStart() { fInUpdate = true; }
void UpdateEnd() { fInUpdate = false; }
void UpdateStart();
void UpdateEnd();
bool InUpdate() const { return fInUpdate; }
BRegion* ClippingRegion() const { return fClipReg; }
protected:
friend class RootLayer;
@ -140,6 +141,7 @@ protected:
BRegion fFullVisible;
BRegion fFull;
BRegion fUpdateReg;
BRegion *fClipReg;
BRegion *clipToPicture;
bool clipToPictureInverse;

View File

@ -1455,6 +1455,16 @@ void ServerWindow::DispatchMessage(int32 code)
break;
}
case AS_BEGIN_UPDATE:
{
cl->UpdateStart();
break;
}
case AS_END_UPDATE:
{
cl->UpdateEnd();
break;
}
// ********** END: BView Messages ***********