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
+27 -31
View File
@@ -57,10 +57,6 @@
# define RBTRACE(x) ; # define RBTRACE(x) ;
#endif #endif
BRegion gRedrawReg;
BList gCopyRegList;
BList gCopyList;
enum { enum {
B_LAYER_ACTION_NONE = 0, B_LAYER_ACTION_NONE = 0,
B_LAYER_ACTION_MOVE, B_LAYER_ACTION_MOVE,
@@ -483,9 +479,9 @@ void Layer::RebuildAndForceRedraw(const BRegion& reg, Layer *target)
StartRebuildRegions(reg, NULL, B_LAYER_NONE, pt); StartRebuildRegions(reg, NULL, B_LAYER_NONE, pt);
if (target) if (target)
gRedrawReg.Include(&(target->fFullVisible)); fRootLayer->fRedrawReg.Include(&(target->fFullVisible));
Redraw(gRedrawReg); Redraw(fRootLayer->fRedrawReg);
EmptyGlobals(); EmptyGlobals();
} }
@@ -507,7 +503,7 @@ void Layer::FullInvalidate(const BRegion& region)
BPoint pt(0,0); BPoint pt(0,0);
StartRebuildRegions(region, NULL,/* B_LAYER_INVALIDATE, pt); */B_LAYER_NONE, pt); StartRebuildRegions(region, NULL,/* B_LAYER_INVALIDATE, pt); */B_LAYER_NONE, pt);
Redraw(gRedrawReg); Redraw(fRootLayer->fRedrawReg);
EmptyGlobals(); EmptyGlobals();
} }
@@ -520,9 +516,9 @@ void Layer::Invalidate(const BRegion& region)
printf("\n"); printf("\n");
#endif #endif
gRedrawReg = region; fRootLayer->fRedrawReg = region;
Redraw(gRedrawReg); Redraw(fRootLayer->fRedrawReg);
EmptyGlobals(); EmptyGlobals();
} }
@@ -996,7 +992,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
r.Exclude(&oldRegion); r.Exclude(&oldRegion);
if(r.CountRects() > 0) if(r.CountRects() > 0)
gRedrawReg.Include(&r); fRootLayer->fRedrawReg.Include(&r);
break; break;
} }
case B_LAYER_MOVE: 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); copyReg->OffsetBy(-pt.x, -pt.y);
BPoint *point = new BPoint(pt); BPoint *point = new BPoint(pt);
gCopyRegList.AddItem(copyReg); fRootLayer->fCopyRegList.AddItem(copyReg);
gCopyList.AddItem(point); fRootLayer->fCopyList.AddItem(point);
} }
else else
{ {
@@ -1026,7 +1022,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
redrawReg.Exclude(&oldRegion); redrawReg.Exclude(&oldRegion);
if(redrawReg.CountRects() > 0 && !(pt.x == 0.0f && pt.y == 0.0f) ) if(redrawReg.CountRects() > 0 && !(pt.x == 0.0f && pt.y == 0.0f) )
{ {
gRedrawReg.Include(&redrawReg); fRootLayer->fRedrawReg.Include(&redrawReg);
} }
break; break;
@@ -1038,7 +1034,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
redrawReg = fVisible; redrawReg = fVisible;
redrawReg.Exclude(&oldRegion); redrawReg.Exclude(&oldRegion);
if(redrawReg.CountRects() > 0) if(redrawReg.CountRects() > 0)
gRedrawReg.Include(&redrawReg); fRootLayer->fRedrawReg.Include(&redrawReg);
break; break;
} }
@@ -1053,7 +1049,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
redrawReg.Exclude(&oldRegion); redrawReg.Exclude(&oldRegion);
if(redrawReg.CountRects() > 0) if(redrawReg.CountRects() > 0)
{ {
gRedrawReg.Include(&redrawReg); fRootLayer->fRedrawReg.Include(&redrawReg);
} }
*copyReg = fVisible; *copyReg = fVisible;
@@ -1062,8 +1058,8 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
if(copyReg->CountRects() > 0 if(copyReg->CountRects() > 0
&& !(dummyNewLocation.x == 0.0f && dummyNewLocation.y == 0.0f)) && !(dummyNewLocation.x == 0.0f && dummyNewLocation.y == 0.0f))
{ {
gCopyRegList.AddItem(copyReg); fRootLayer->fCopyRegList.AddItem(copyReg);
gCopyList.AddItem(new BPoint(dummyNewLocation)); fRootLayer->fCopyList.AddItem(new BPoint(dummyNewLocation));
} }
break; break;
@@ -1088,7 +1084,7 @@ void Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint
fFullVisible.PrintToStream(); fFullVisible.PrintToStream();
fVisible.PrintToStream(); fVisible.PrintToStream();
printf("==========RedrawReg===========\n"); printf("==========RedrawReg===========\n");
gRedrawReg.PrintToStream(); fRootLayer->fRedrawReg.PrintToStream();
printf("=====================\n"); printf("=====================\n");
#endif #endif
@@ -1121,7 +1117,7 @@ void Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 actio
fVisible.PrintToStream(); fVisible.PrintToStream();
oldVisible.PrintToStream(); oldVisible.PrintToStream();
printf("=====!=====RedrawReg=====!=====\n"); printf("=====!=====RedrawReg=====!=====\n");
gRedrawReg.PrintToStream(); fRootLayer->fRedrawReg.PrintToStream();
printf("=====================\n"); printf("=====================\n");
#endif #endif
@@ -1132,17 +1128,17 @@ void Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 actio
redrawReg.Exclude(&oldVisible); redrawReg.Exclude(&oldVisible);
if (redrawReg.CountRects() > 0) if (redrawReg.CountRects() > 0)
gRedrawReg.Include(&redrawReg); fRootLayer->fRedrawReg.Include(&redrawReg);
#ifdef DEBUG_LAYER_REBUILD #ifdef DEBUG_LAYER_REBUILD
printf("Layer(%s)::StartRebuildREgions() ended! Redraw Region:\n", GetName()); printf("Layer(%s)::StartRebuildREgions() ended! Redraw Region:\n", GetName());
gRedrawReg.PrintToStream(); fRootLayer->fRedrawReg.PrintToStream();
printf("\n"); printf("\n");
printf("Layer(%s)::StartRebuildREgions() ended! Copy Region:\n", GetName()); 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(); ((BRegion*)(fRootLayer->fCopyRegList.ItemAt(k)))->PrintToStream();
((BPoint*)(gCopyList.ItemAt(k)))->PrintToStream(); ((BPoint*)(fRootLayer->fCopyList.ItemAt(k)))->PrintToStream();
} }
printf("\n"); printf("\n");
#endif #endif
@@ -1178,8 +1174,8 @@ void Layer::move_layer(float x, float y)
BRect rect(fFull.Frame().OffsetByCopy(pt)); BRect rect(fFull.Frame().OffsetByCopy(pt));
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt); fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt);
fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible); fDriver->CopyRegionList(&fRootLayer->fCopyRegList, &fRootLayer->fCopyList, fRootLayer->fCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(gRedrawReg, this); fParent->Redraw(fRootLayer->fRedrawReg, this);
EmptyGlobals(); EmptyGlobals();
@@ -1190,12 +1186,12 @@ void Layer::EmptyGlobals()
{ {
void *item; void *item;
gRedrawReg.MakeEmpty(); fRootLayer->fRedrawReg.MakeEmpty();
while((item = gCopyRegList.RemoveItem((int32)0))) while((item = fRootLayer->fCopyRegList.RemoveItem((int32)0)))
delete (BRegion*)item; delete (BRegion*)item;
while((item = gCopyList.RemoveItem((int32)0))) while((item = fRootLayer->fCopyList.RemoveItem((int32)0)))
delete (BPoint*)item; delete (BPoint*)item;
} }
@@ -1297,8 +1293,8 @@ void Layer::resize_layer(float x, float y)
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_RESIZE, pt); fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_RESIZE, pt);
fDriver->CopyRegionList(&gCopyRegList, &gCopyList, gCopyRegList.CountItems(), &fFullVisible); fDriver->CopyRegionList(&fRootLayer->fCopyRegList, &fRootLayer->fCopyList, fRootLayer->fCopyRegList.CountItems(), &fFullVisible);
fParent->Redraw(gRedrawReg, this); fParent->Redraw(fRootLayer->fRedrawReg, this);
EmptyGlobals(); EmptyGlobals();
+1 -2
View File
@@ -49,7 +49,7 @@
#include "DisplayDriver.h" #include "DisplayDriver.h"
#include "ServerProtocol.h" #include "ServerProtocol.h"
#define DEBUG_ROOTLAYER //#define DEBUG_ROOTLAYER
#ifdef DEBUG_ROOTLAYER #ifdef DEBUG_ROOTLAYER
#define STRACE(a) printf a #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)); STRACE(("info: RootLayer(%s)::WorkingThread listening on port %ld.\n", oneRootLayer->GetName(), oneRootLayer->fListenPort));
for(;;) for(;;)
{ {
printf("Getting a message from the queue\n");
err = messageQueue.GetNextReply(&code); err = messageQueue.GetNextReply(&code);
oneRootLayer->Lock(); oneRootLayer->Lock();
+7 -2
View File
@@ -126,8 +126,13 @@ public:
// "Private" to app_server :-) - they should not be used // "Private" to app_server :-) - they should not be used
void RemoveAppWindow(WinBorder *wb); void RemoveAppWindow(WinBorder *wb);
FMWList fMainFMWList; FMWList fMainFMWList;
BLocker fMainLock; BRegion fRedrawReg;
BList fCopyRegList;
BList fCopyList;
// TODO: remove! Quick!
BLocker fMainLock;
private: private: