this fixes the bugs in the update session region enforcement during client drawing, there is only one bug left now: resized ViewLayers don't invalidate the correct regions (they don't take areas into account that are hidden because the parent is too small)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15168 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2005-11-26 17:01:29 +00:00
parent df36243372
commit f5552ed0b2
5 changed files with 26 additions and 2 deletions

View File

@ -38,7 +38,7 @@ ClientLooper::MessageReceived(BMessage* message)
for (int32 i = 0; i < fViewCount; i++) { for (int32 i = 0; i < fViewCount; i++) {
// the client is slow // the client is slow
snooze(20000L); // snooze(40000L);
// send the command to redraw a view // send the command to redraw a view
BMessage command(MSG_DRAWING_COMMAND); BMessage command(MSG_DRAWING_COMMAND);
command.AddInt32("token", i); command.AddInt32("token", i);

View File

@ -539,6 +539,7 @@ Desktop::MarkDirty(BRegion* region)
// add the new dirty region to the culmulative dirty region // add the new dirty region to the culmulative dirty region
fDirtyRegion.Include(region); fDirtyRegion.Include(region);
#if SHOW_GLOBAL_DIRTY_REGION
if (fDrawingEngine->Lock()) { if (fDrawingEngine->Lock()) {
fDrawingEngine->SetHighColor(255, 0, 0); fDrawingEngine->SetHighColor(255, 0, 0);
fDrawingEngine->FillRegion(region); fDrawingEngine->FillRegion(region);
@ -546,6 +547,7 @@ if (fDrawingEngine->Lock()) {
fDrawingEngine->Unlock(); fDrawingEngine->Unlock();
snooze(100000); snooze(100000);
} }
#endif
// send redraw messages to all windows intersecting the dirty region // send redraw messages to all windows intersecting the dirty region
_TriggerWindowRedrawing(region); _TriggerWindowRedrawing(region);

View File

@ -19,6 +19,8 @@ enum {
}; };
#define MULTI_LOCKER 0 #define MULTI_LOCKER 0
#define SHOW_GLOBAL_DIRTY_REGION 0
#define SHOW_WINDOW_CONTENT_DIRTY_REGION 0
class Desktop : public BLooper { class Desktop : public BLooper {
public: public:

View File

@ -322,6 +322,8 @@ WindowLayer::_DrawContents(ViewLayer* layer)
dirtyContentRegion.IntersectWith(fDesktop->DirtyRegion()); dirtyContentRegion.IntersectWith(fDesktop->DirtyRegion());
if (dirtyContentRegion.CountRects() > 0) { if (dirtyContentRegion.CountRects() > 0) {
#if SHOW_WINDOW_CONTENT_DIRTY_REGION
if (fDrawingEngine->Lock()) { if (fDrawingEngine->Lock()) {
fDrawingEngine->SetHighColor(0, 0, 255); fDrawingEngine->SetHighColor(0, 0, 255);
fDrawingEngine->FillRegion(&dirtyContentRegion); fDrawingEngine->FillRegion(&dirtyContentRegion);
@ -329,7 +331,7 @@ if (fDrawingEngine->Lock()) {
fDrawingEngine->Unlock(); fDrawingEngine->Unlock();
snooze(100000); snooze(100000);
} }
#endif
// send UPDATE message to the client // send UPDATE message to the client
_MarkContentDirty(&dirtyContentRegion); _MarkContentDirty(&dirtyContentRegion);
@ -435,6 +437,14 @@ WindowLayer::_MarkContentDirty(BRegion* contentDirtyRegion)
fPendingUpdateSession->Include(contentDirtyRegion); fPendingUpdateSession->Include(contentDirtyRegion);
} }
// clip pending update session from current,
// current update session, because the backgrounds have been
// cleared again already
if (fCurrentUpdateSession) {
fCurrentUpdateSession->Exclude(contentDirtyRegion);
fEffectiveDrawingRegionValid = false;
}
if (!fUpdateRequested) { if (!fUpdateRequested) {
// send this to client // send this to client
fClient->PostMessage(MSG_UPDATE); fClient->PostMessage(MSG_UPDATE);
@ -456,6 +466,7 @@ WindowLayer::_BeginUpdate()
// session enforced // session enforced
fInUpdate = true; fInUpdate = true;
} }
fEffectiveDrawingRegionValid = false;
} }
} }
@ -468,6 +479,7 @@ WindowLayer::_EndUpdate()
fCurrentUpdateSession = NULL; fCurrentUpdateSession = NULL;
fInUpdate = false; fInUpdate = false;
fEffectiveDrawingRegionValid = false;
} }
if (fPendingUpdateSession) { if (fPendingUpdateSession) {
// send this to client // send this to client
@ -498,6 +510,13 @@ UpdateSession::Include(BRegion* additionalDirty)
fDirtyRegion.Include(additionalDirty); fDirtyRegion.Include(additionalDirty);
} }
// Exclude
void
UpdateSession::Exclude(BRegion* dirtyInNextSession)
{
fDirtyRegion.Exclude(dirtyInNextSession);
}
// MoveBy // MoveBy
void void
UpdateSession::MoveBy(int32 x, int32 y) UpdateSession::MoveBy(int32 x, int32 y)

View File

@ -27,6 +27,7 @@ class UpdateSession {
virtual ~UpdateSession(); virtual ~UpdateSession();
void Include(BRegion* additionalDirty); void Include(BRegion* additionalDirty);
void Exclude(BRegion* dirtyInNextSession);
inline BRegion& DirtyRegion() inline BRegion& DirtyRegion()
{ return fDirtyRegion; } { return fDirtyRegion; }