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; clipToPicture = NULL;
// NOW all regions (fVisible, fFullVisible, fFull) are empty // NOW all regions (fVisible, fFullVisible, fFull) are empty
fClipReg = &fVisible;
STRACE(("Layer(%s) successfuly created\n", GetName())); STRACE(("Layer(%s) successfuly created\n", GetName()));
} }
@ -509,8 +510,14 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
// Update one. // Update one.
BRegion common(lay->fFullVisible); BRegion common(lay->fFullVisible);
common.IntersectWith(&reg); 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); lay->RequestDraw(reg, NULL);
if (lay->fClassID == AS_WINBORDER_CLASS)
lay->Window()->Unlock();
}
} }
} }
} }
@ -533,6 +540,21 @@ r.PrintToStream();
// empty HOOK function. // 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) void Layer::Show(bool invalidate)
{ {

View File

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

View File

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