3 global variables (gRedrawReg, gCopyRegList, gCopyList) went into RootLayer's property

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@11006 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca 2005-01-24 17:18:19 +00:00
parent 11e38e920f
commit 383461c7ee
3 changed files with 36 additions and 36 deletions

View File

@ -57,10 +57,6 @@
# define RBTRACE(x) ;
#endif
BRegion gRedrawReg;
BList gCopyRegList;
BList gCopyList;
enum {
B_LAYER_ACTION_NONE = 0,
B_LAYER_ACTION_MOVE,
@ -483,9 +479,9 @@ void Layer::RebuildAndForceRedraw(const BRegion& reg, Layer *target)
StartRebuildRegions(reg, NULL, B_LAYER_NONE, pt);
if (target)
gRedrawReg.Include(&(target->fFullVisible));
fRootLayer->fRedrawReg.Include(&(target->fFullVisible));
Redraw(gRedrawReg);
Redraw(fRootLayer->fRedrawReg);
EmptyGlobals();
}
@ -507,7 +503,7 @@ void Layer::FullInvalidate(const BRegion& region)
BPoint pt(0,0);
StartRebuildRegions(region, NULL,/* B_LAYER_INVALIDATE, pt); */B_LAYER_NONE, pt);
Redraw(gRedrawReg);
Redraw(fRootLayer->fRedrawReg);
EmptyGlobals();
}
@ -520,9 +516,9 @@ void Layer::Invalidate(const BRegion& region)
printf("\n");
#endif
gRedrawReg = region;
fRootLayer->fRedrawReg = region;
Redraw(gRedrawReg);
Redraw(fRootLayer->fRedrawReg);
EmptyGlobals();
}
@ -996,7 +992,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
r.Exclude(&oldRegion);
if(r.CountRects() > 0)
gRedrawReg.Include(&r);
fRootLayer->fRedrawReg.Include(&r);
break;
}
case B_LAYER_MOVE:
@ -1014,8 +1010,8 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
{
copyReg->OffsetBy(-pt.x, -pt.y);
BPoint *point = new BPoint(pt);
gCopyRegList.AddItem(copyReg);
gCopyList.AddItem(point);
fRootLayer->fCopyRegList.AddItem(copyReg);
fRootLayer->fCopyList.AddItem(point);
}
else
{
@ -1026,7 +1022,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
redrawReg.Exclude(&oldRegion);
if(redrawReg.CountRects() > 0 && !(pt.x == 0.0f && pt.y == 0.0f) )
{
gRedrawReg.Include(&redrawReg);
fRootLayer->fRedrawReg.Include(&redrawReg);
}
break;
@ -1038,7 +1034,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
redrawReg = fVisible;
redrawReg.Exclude(&oldRegion);
if(redrawReg.CountRects() > 0)
gRedrawReg.Include(&redrawReg);
fRootLayer->fRedrawReg.Include(&redrawReg);
break;
}
@ -1053,7 +1049,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
redrawReg.Exclude(&oldRegion);
if(redrawReg.CountRects() > 0)
{
gRedrawReg.Include(&redrawReg);
fRootLayer->fRedrawReg.Include(&redrawReg);
}
*copyReg = fVisible;
@ -1062,8 +1058,8 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
if(copyReg->CountRects() > 0
&& !(dummyNewLocation.x == 0.0f && dummyNewLocation.y == 0.0f))
{
gCopyRegList.AddItem(copyReg);
gCopyList.AddItem(new BPoint(dummyNewLocation));
fRootLayer->fCopyRegList.AddItem(copyReg);
fRootLayer->fCopyList.AddItem(new BPoint(dummyNewLocation));
}
break;
@ -1088,7 +1084,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
fFullVisible.PrintToStream();
fVisible.PrintToStream();
printf("==========RedrawReg===========\n");
gRedrawReg.PrintToStream();
fRootLayer->fRedrawReg.PrintToStream();
printf("=====================\n");
#endif
@ -1121,7 +1117,7 @@ void Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 actio
fVisible.PrintToStream();
oldVisible.PrintToStream();
printf("=====!=====RedrawReg=====!=====\n");
gRedrawReg.PrintToStream();
fRootLayer->fRedrawReg.PrintToStream();
printf("=====================\n");
#endif
@ -1132,17 +1128,17 @@ void Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 actio
redrawReg.Exclude(&oldVisible);
if (redrawReg.CountRects() > 0)
gRedrawReg.Include(&redrawReg);
fRootLayer->fRedrawReg.Include(&redrawReg);
#ifdef DEBUG_LAYER_REBUILD
printf("Layer(%s)::StartRebuildREgions() ended! Redraw Region:\n", GetName());
gRedrawReg.PrintToStream();
fRootLayer->fRedrawReg.PrintToStream();
printf("\n");
printf("Layer(%s)::StartRebuildREgions() ended! Copy Region:\n", GetName());
for(int32 k=0; k<gCopyRegList.CountItems(); k++)
for(int32 k=0; k<fRootLayer->fCopyRegList.CountItems(); k++)
{
((BRegion*)(gCopyRegList.ItemAt(k)))->PrintToStream();
((BPoint*)(gCopyList.ItemAt(k)))->PrintToStream();
((BRegion*)(fRootLayer->fCopyRegList.ItemAt(k)))->PrintToStream();
((BPoint*)(fRootLayer->fCopyList.ItemAt(k)))->PrintToStream();
}
printf("\n");
#endif
@ -1178,8 +1174,8 @@ void Layer::move_layer(float x, float y)
BRect rect(fFull.Frame().OffsetByCopy(pt));
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt);
fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(gRedrawReg, this);
fDriver->CopyRegionList(&fRootLayer->fCopyRegList, &fRootLayer->fCopyList, fRootLayer->fCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(fRootLayer->fRedrawReg, this);
EmptyGlobals();
@ -1190,12 +1186,12 @@ void Layer::EmptyGlobals()
{
void *item;
gRedrawReg.MakeEmpty();
fRootLayer->fRedrawReg.MakeEmpty();
while((item = gCopyRegList.RemoveItem((int32)0)))
while((item = fRootLayer->fCopyRegList.RemoveItem((int32)0)))
delete (BRegion*)item;
while((item = gCopyList.RemoveItem((int32)0)))
while((item = fRootLayer->fCopyList.RemoveItem((int32)0)))
delete (BPoint*)item;
}
@ -1297,8 +1293,8 @@ void Layer::resize_layer(float x, float y)
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_RESIZE, pt);
fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(gRedrawReg, this);
fDriver->CopyRegionList(&fRootLayer->fCopyRegList, &fRootLayer->fCopyList, fRootLayer->fCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(fRootLayer->fRedrawReg, this);
EmptyGlobals();

View File

@ -49,7 +49,7 @@
#include "DisplayDriver.h"
#include "ServerProtocol.h"
#define DEBUG_ROOTLAYER
//#define DEBUG_ROOTLAYER
#ifdef DEBUG_ROOTLAYER
#define STRACE(a) printf a
@ -145,7 +145,6 @@ int32 RootLayer::WorkingThread(void *data)
STRACE(("info: RootLayer(%s)::WorkingThread listening on port %ld.\n", oneRootLayer->GetName(), oneRootLayer->fListenPort));
for(;;)
{
printf("Getting a message from the queue\n");
err = messageQueue.GetNextReply(&code);
oneRootLayer->Lock();

View File

@ -126,8 +126,13 @@ public:
// "Private" to app_server :-) - they should not be used
void RemoveAppWindow(WinBorder *wb);
FMWList fMainFMWList;
BLocker fMainLock;
FMWList fMainFMWList;
BRegion fRedrawReg;
BList fCopyRegList;
BList fCopyList;
// TODO: remove! Quick!
BLocker fMainLock;
private:
@ -145,7 +150,7 @@ private:
thread_id fThreadID;
port_id fListenPort;
BList fScreenPtrList;
int32 fRows;
int32 fColumns;