remaining bugs are with update session region tracking and dirty regions when layers are moved and resized, the window clipping itself seems to work reliably now
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15163 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -76,8 +76,8 @@ WindowLayer::MessageReceived(BMessage* message)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_DrawContents(fTopLayer);
|
|
||||||
_DrawBorder();
|
_DrawBorder();
|
||||||
|
_DrawContents(fTopLayer);
|
||||||
|
|
||||||
fDesktop->ReadUnlockClipping();
|
fDesktop->ReadUnlockClipping();
|
||||||
} else {
|
} else {
|
||||||
@@ -171,7 +171,7 @@ WindowLayer::GetContentRegion(BRegion* region)
|
|||||||
// resize handle
|
// resize handle
|
||||||
// if (B_DOCUMENT_WINDOW_LOOK)
|
// if (B_DOCUMENT_WINDOW_LOOK)
|
||||||
fContentRegion.Exclude(BRect(fFrame.right - 10, fFrame.bottom - 10,
|
fContentRegion.Exclude(BRect(fFrame.right - 10, fFrame.bottom - 10,
|
||||||
fFrame.right, fFrame.bottom));
|
fFrame.right, fFrame.bottom));
|
||||||
|
|
||||||
fContentRegionValid = true;
|
fContentRegionValid = true;
|
||||||
}
|
}
|
||||||
@@ -189,7 +189,7 @@ WindowLayer::SetFocus(bool focus)
|
|||||||
if (fDesktop->ReadLockClipping()) {
|
if (fDesktop->ReadLockClipping()) {
|
||||||
BRegion dirty(fBorderRegion);
|
BRegion dirty(fBorderRegion);
|
||||||
dirty.IntersectWith(&fVisibleRegion);
|
dirty.IntersectWith(&fVisibleRegion);
|
||||||
MarkDirty(&dirty);
|
fDesktop->MarkDirty(&dirty);
|
||||||
|
|
||||||
fDesktop->ReadUnlockClipping();
|
fDesktop->ReadUnlockClipping();
|
||||||
}
|
}
|
||||||
@@ -281,7 +281,7 @@ WindowLayer::MarkDirty(BRegion* regionOnScreen)
|
|||||||
fDesktop->MarkDirty(regionOnScreen);
|
fDesktop->MarkDirty(regionOnScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MarkDirty
|
// MarkContentDirty
|
||||||
void
|
void
|
||||||
WindowLayer::MarkContentDirty(BRegion* regionOnScreen)
|
WindowLayer::MarkContentDirty(BRegion* regionOnScreen)
|
||||||
{
|
{
|
||||||
@@ -322,13 +322,21 @@ WindowLayer::_DrawContents(ViewLayer* layer)
|
|||||||
dirtyContentRegion.IntersectWith(fDesktop->DirtyRegion());
|
dirtyContentRegion.IntersectWith(fDesktop->DirtyRegion());
|
||||||
|
|
||||||
if (dirtyContentRegion.CountRects() > 0) {
|
if (dirtyContentRegion.CountRects() > 0) {
|
||||||
|
if (fDrawingEngine->Lock()) {
|
||||||
|
fDrawingEngine->SetHighColor(0, 0, 255);
|
||||||
|
fDrawingEngine->FillRegion(&dirtyContentRegion);
|
||||||
|
fDrawingEngine->MarkDirty(&dirtyContentRegion);
|
||||||
|
fDrawingEngine->Unlock();
|
||||||
|
snooze(100000);
|
||||||
|
}
|
||||||
|
|
||||||
// send UPDATE message to the client
|
// send UPDATE message to the client
|
||||||
_MarkContentDirty(&dirtyContentRegion);
|
_MarkContentDirty(&dirtyContentRegion);
|
||||||
|
|
||||||
|
fDesktop->MarkClean(&dirtyContentRegion);
|
||||||
|
|
||||||
layer->Draw(fDrawingEngine, &dirtyContentRegion,
|
layer->Draw(fDrawingEngine, &dirtyContentRegion,
|
||||||
&fVisibleContentRegion, true);
|
&fVisibleContentRegion, true);
|
||||||
|
|
||||||
fDesktop->MarkClean(&dirtyContentRegion);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fDesktop->ReadUnlockClipping();
|
fDesktop->ReadUnlockClipping();
|
||||||
@@ -385,13 +393,23 @@ WindowLayer::_DrawBorder()
|
|||||||
// intersect with the Desktop's dirty region
|
// intersect with the Desktop's dirty region
|
||||||
dirtyBorderRegion.IntersectWith(fDesktop->DirtyRegion());
|
dirtyBorderRegion.IntersectWith(fDesktop->DirtyRegion());
|
||||||
|
|
||||||
if (dirtyBorderRegion.Frame().IsValid()) {
|
if (dirtyBorderRegion.CountRects() > 0) {
|
||||||
if (fDrawingEngine->Lock()) {
|
if (fDrawingEngine->Lock()) {
|
||||||
if (fFocus)
|
|
||||||
fDrawingEngine->SetHighColor(255, 203, 0, 255);
|
fDrawingEngine->ConstrainClippingRegion(&dirtyBorderRegion);
|
||||||
else
|
|
||||||
fDrawingEngine->SetHighColor(216, 216, 216, 0);
|
if (fFocus) {
|
||||||
fDrawingEngine->FillRegion(&dirtyBorderRegion);
|
fDrawingEngine->SetLowColor(255, 203, 0, 255);
|
||||||
|
fDrawingEngine->SetHighColor(0, 0, 0, 255);
|
||||||
|
} else {
|
||||||
|
fDrawingEngine->SetLowColor(216, 216, 216, 0);
|
||||||
|
fDrawingEngine->SetHighColor(0, 0, 0, 255);
|
||||||
|
}
|
||||||
|
|
||||||
|
fDrawingEngine->FillRect(dirtyBorderRegion.Frame(), B_SOLID_LOW);
|
||||||
|
fDrawingEngine->DrawString(Name(), BPoint(fFrame.left, fFrame.top - 5));
|
||||||
|
|
||||||
|
fDrawingEngine->ConstrainClippingRegion(NULL);
|
||||||
fDrawingEngine->MarkDirty(&dirtyBorderRegion);
|
fDrawingEngine->MarkDirty(&dirtyBorderRegion);
|
||||||
fDrawingEngine->Unlock();
|
fDrawingEngine->Unlock();
|
||||||
}
|
}
|
||||||
@@ -404,16 +422,17 @@ WindowLayer::_DrawBorder()
|
|||||||
|
|
||||||
// _MarkContentDirty
|
// _MarkContentDirty
|
||||||
void
|
void
|
||||||
WindowLayer::_MarkContentDirty(BRegion* localDirty)
|
WindowLayer::_MarkContentDirty(BRegion* contentDirtyRegion)
|
||||||
{
|
{
|
||||||
if (localDirty->CountRects() <= 0)
|
if (contentDirtyRegion->CountRects() <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!fPendingUpdateSession) {
|
if (!fPendingUpdateSession) {
|
||||||
// create new pending
|
// create new pending
|
||||||
fPendingUpdateSession = new UpdateSession(*localDirty);
|
fPendingUpdateSession = new UpdateSession(*contentDirtyRegion);
|
||||||
} else {
|
} else {
|
||||||
// add to pending
|
// add to pending
|
||||||
fPendingUpdateSession->Include(localDirty);
|
fPendingUpdateSession->Include(contentDirtyRegion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fUpdateRequested) {
|
if (!fUpdateRequested) {
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ class WindowLayer : public BLooper {
|
|||||||
void _DrawClient(int32 token);
|
void _DrawClient(int32 token);
|
||||||
void _DrawBorder();
|
void _DrawBorder();
|
||||||
|
|
||||||
void _MarkContentDirty(BRegion* localDirty);
|
void _MarkContentDirty(BRegion* contentDirtyRegion);
|
||||||
void _BeginUpdate();
|
void _BeginUpdate();
|
||||||
void _EndUpdate();
|
void _EndUpdate();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user