This fixes up the last known remaining issues with the update code. It works perfectly now.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12197 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-03-31 16:48:51 +00:00
parent 9f7e77bd63
commit a2bc7be9ed
2 changed files with 53 additions and 47 deletions
+47 -44
View File
@@ -535,42 +535,40 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
if (!startFrom)
redraw = true;
if (HasClient() && IsTopLayer())
{
// calculate the minimum region/rectangle to be updated with
// a single message to the client.
fUpdateReg = fFullVisible;
if (fFlags & B_FULL_UPDATE_ON_RESIZE
&& fFrameAction == B_LAYER_ACTION_RESIZE)
{
// do nothing
}
else
{
fUpdateReg.IntersectWith(&reg);
}
if (fUpdateReg.CountRects() > 0)
{
if (!fOwner->fInUpdate)
{
fOwner->prevInvalid = fUpdateReg;
SendUpdateMsg();
}
else
{
fOwner->zUpdateReg.Include(&fUpdateReg);
}
}
}
if (fVisible.CountRects() > 0)
{
// client side drawing. Send only one UPDATE message!
if (HasClient())
{
if (IsTopLayer())
{
// calculate the minimum region/rectangle to be updated with
// a single message to the client.
fUpdateReg = fFullVisible;
if (fFlags & B_FULL_UPDATE_ON_RESIZE
&& fFrameAction == B_LAYER_ACTION_RESIZE)
{
// do nothing
}
else
{
fUpdateReg.IntersectWith(&reg);
}
if (fUpdateReg.CountRects() > 0)
{
if (!fOwner->fInUpdate)
{
fOwner->prevInvalid = fUpdateReg;
SendUpdateMsg();
}
else
fOwner->zUpdateReg.Include(&fUpdateReg);
}
// we're not that different than other. We too have an
// update region to which our drawing is restrincted.
}
// calculate the update region, then...
// calculate the update region
fUpdateReg = fVisible;
if (fFlags & B_FULL_UPDATE_ON_RESIZE
&& fFrameAction == B_LAYER_ACTION_RESIZE)
@@ -586,9 +584,11 @@ void Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
{
// clear background with viewColor.
fDriver->ConstrainClippingRegion(&fUpdateReg);
// RGBColor c(rand()%255,rand()%255,rand()%255);
// fDriver->FillRect(fUpdateReg.Frame(), c);
fDriver->FillRect(fUpdateReg.Frame(), fLayerData->viewcolor);
fDriver->ConstrainClippingRegion(NULL);
SendUpdateMsg();
fUpdateReg.MakeEmpty();
}
}
else
@@ -681,9 +681,9 @@ void Layer::UpdateEnd()
wb->zUpdateReg.Exclude(&wb->prevInvalid);
if (wb->zUpdateReg.CountRects() > 0)
{
wb->prevInvalid = wb->zUpdateReg;
fUpdateReg = wb->zUpdateReg;
SendUpdateMsg();
BRegion reg(wb->zUpdateReg);
wb->RequestDraw(reg, NULL);
wb->zUpdateReg.MakeEmpty();
}
else
wb->prevInvalid.MakeEmpty();
@@ -1154,6 +1154,11 @@ void Layer::move_layer(float x, float y)
BPoint pt(x,y);
BRect rect(fFull.Frame().OffsetByCopy(pt));
if (fClassID == AS_WINBORDER_CLASS)
{
WinBorder *wb = (WinBorder*)this;
wb->prevInvalid.OffsetBy(x, y);
}
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt);
fDriver->CopyRegionList(&fRootLayer->fCopyRegList,
@@ -1477,16 +1482,14 @@ void Layer::SendViewMovedMsg()
//! Sends an _UPDATE_ message to the client BWindow
void Layer::SendUpdateMsg()
{
if( fServerWin )
{
BMessage msg;
msg.what = _UPDATE_;
msg.AddRect("_rect", ConvertFromTop(fUpdateReg.Frame()) );
msg.AddRect("debug_rect", fUpdateReg.Frame() );
msg.AddInt32("_token",fViewToken);
BMessage msg;
msg.what = _UPDATE_;
msg.AddRect("_rect", ConvertFromTop(fUpdateReg.Frame()) );
msg.AddRect("debug_rect", fUpdateReg.Frame() );
msg.AddInt32("_token",fViewToken);
fServerWin->SendMessageToClient( &msg );
}
fOwner->Window()->SendMessageToClient(&msg);
//fServerWin->SendMessageToClient( &msg );
}
Layer *Layer::VirtualTopChild() const
+6 -3
View File
@@ -1409,7 +1409,7 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
{
DTRACE(("ServerWindowo %s: AS_BEGIN_UPDATE\n",fTitle.String()));
fWinBorder->GetRootLayer()->Lock();
cl->UpdateStart();
fWinBorder->UpdateStart();
fWinBorder->GetRootLayer()->Unlock();
break;
}
@@ -1417,7 +1417,7 @@ void ServerWindow::DispatchMessage(int32 code, LinkMsgReader &link)
{
DTRACE(("ServerWindowo %s: AS_END_UPDATE\n",fTitle.String()));
fWinBorder->GetRootLayer()->Lock();
cl->UpdateEnd();
fWinBorder->UpdateEnd();
fWinBorder->GetRootLayer()->Unlock();
break;
}
@@ -1651,9 +1651,12 @@ void ServerWindow::DispatchGraphicsMessage(int32 code, LinkMsgReader &link)
{
fWinBorder->GetRootLayer()->Lock();
BRegion rreg(cl->fVisible);
rreg.Include(&fWinBorder->yUpdateReg);
rreg.IntersectWith(&fWinBorder->yUpdateReg);
desktop->GetDisplayDriver()->ConstrainClippingRegion(&rreg);
// rgb_color rrr = cl->fLayerData->viewcolor.GetColor32();
// RGBColor c(rand()%255,rand()%255,rand()%255);
// desktop->GetDisplayDriver()->FillRect(BRect(0,0,639,479), c);
switch (code)
{