_TriggerContentRedraw is now given the dirty region, so ProcessDirtyRegion does not have to be called for triggering window local redraws

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15593 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus
2005-12-19 21:16:23 +00:00
parent 85e1d00d58
commit ce8ae4d8c2
2 changed files with 26 additions and 13 deletions
+25 -12
View File
@@ -401,6 +401,9 @@ WindowLayer::ResizeBy(int32 x, int32 y, BRegion* dirtyRegion)
if (fTopLayer != NULL) if (fTopLayer != NULL)
fTopLayer->ResizeBy(x, y, dirtyRegion); fTopLayer->ResizeBy(x, y, dirtyRegion);
//if (dirtyRegion)
//fDrawingEngine->FillRegion(*dirtyRegion, RGBColor(0, 255, 255, 255));
// send a message to the client informing about the changed size // send a message to the client informing about the changed size
BRect frame(Frame()); BRect frame(Frame());
BMessage msg(B_WINDOW_RESIZED); BMessage msg(B_WINDOW_RESIZED);
@@ -429,7 +432,10 @@ WindowLayer::ScrollViewBy(ViewLayer* view, int32 dx, int32 dy)
BRegion dirty; BRegion dirty;
view->ScrollBy(dx, dy, &dirty); view->ScrollBy(dx, dy, &dirty);
MarkContentDirty(dirty); //fDrawingEngine->FillRegion(dirty, RGBColor(255, 0, 255, 255));
//snooze(2000);
_TriggerContentRedraw(dirty);
fDesktop->UnlockSingleWindow(); fDesktop->UnlockSingleWindow();
} }
@@ -578,6 +584,7 @@ WindowLayer::GetEffectiveDrawingRegion(ViewLayer* layer, BRegion& region)
fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession.DirtyRegion()); fEffectiveDrawingRegion.IntersectWith(&fCurrentUpdateSession.DirtyRegion());
} else { } else {
// not in update, the view can draw everywhere // not in update, the view can draw everywhere
//printf("WindowLayer(%s)::GetEffectiveDrawingRegion(for %s) - outside update\n", Title(), layer->Name());
} }
fEffectiveDrawingRegionValid = true; fEffectiveDrawingRegionValid = true;
@@ -640,7 +647,11 @@ WindowLayer::RedrawDirtyRegion()
if (IsVisible()) { if (IsVisible()) {
_DrawBorder(); _DrawBorder();
_TriggerContentRedraw();
BRegion dirtyContentRegion(VisibleContentRegion());
dirtyContentRegion.IntersectWith(&fDirtyRegion);
_TriggerContentRedraw(dirtyContentRegion);
} }
// reset the dirty region, since // reset the dirty region, since
@@ -677,7 +688,7 @@ WindowLayer::MarkContentDirty(BRegion& regionOnScreen)
// an update message is triggered // an update message is triggered
if (!fHidden && fDesktop && fDesktop->LockSingleWindow()) { if (!fHidden && fDesktop && fDesktop->LockSingleWindow()) {
regionOnScreen.IntersectWith(&VisibleContentRegion()); regionOnScreen.IntersectWith(&VisibleContentRegion());
ProcessDirtyRegion(regionOnScreen); _TriggerContentRedraw(regionOnScreen);
fDesktop->UnlockSingleWindow(); fDesktop->UnlockSingleWindow();
} }
@@ -696,11 +707,15 @@ WindowLayer::InvalidateView(ViewLayer* layer, BRegion& layerRegion)
_UpdateContentRegion(); _UpdateContentRegion();
layer->ConvertToScreen(&layerRegion); layer->ConvertToScreen(&layerRegion);
layerRegion.IntersectWith(&layer->ScreenClipping(&fContentRegion)); layerRegion.IntersectWith(&fVisibleRegion);
// TODO: would be nice if this didn't fire off a REDRAW message, if (layerRegion.CountRects() > 0) {
// but currently, it is cleaner to do it, so that backgrounds are layerRegion.IntersectWith(&layer->ScreenClipping(&fContentRegion));
// properly cleared in _TriggerContentRedraw()
MarkContentDirty(layerRegion); //fDrawingEngine->FillRegion(layerRegion, RGBColor(255, 255, 0, 255));
//snooze(2000);
_TriggerContentRedraw(layerRegion);
}
fDesktop->UnlockSingleWindow(); fDesktop->UnlockSingleWindow();
} }
@@ -1528,11 +1543,8 @@ WindowLayer::_ShiftPartOfRegion(BRegion* region, BRegion* regionToShift,
void void
WindowLayer::_TriggerContentRedraw() WindowLayer::_TriggerContentRedraw(BRegion& dirtyContentRegion)
{ {
BRegion dirtyContentRegion(VisibleContentRegion());
dirtyContentRegion.IntersectWith(&fDirtyRegion);
if (dirtyContentRegion.CountRects() > 0) { if (dirtyContentRegion.CountRects() > 0) {
// send UPDATE message to the client // send UPDATE message to the client
_TransferToUpdateSession(&dirtyContentRegion); _TransferToUpdateSession(&dirtyContentRegion);
@@ -1634,6 +1646,7 @@ WindowLayer::_SendUpdateMessage()
updateRect.OffsetBy(-fFrame.left, -fFrame.top); updateRect.OffsetBy(-fFrame.left, -fFrame.top);
message.AddRect("_rect", updateRect); message.AddRect("_rect", updateRect);
ServerWindow()->SendMessageToClient(&message); ServerWindow()->SendMessageToClient(&message);
fUpdateRequested = true; fUpdateRequested = true;
// TODO: the toggling between the update sessions is too // TODO: the toggling between the update sessions is too
+1 -1
View File
@@ -196,7 +196,7 @@ class WindowLayer {
int32 xOffset, int32 yOffset); int32 xOffset, int32 yOffset);
// different types of drawing // different types of drawing
void _TriggerContentRedraw(); void _TriggerContentRedraw(BRegion& dirty);
void _DrawBorder(); void _DrawBorder();
// handling update sessions // handling update sessions