Started adding new clipping code - not active ATM. Removed Virtual prefix

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13159 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-06-15 19:01:43 +00:00
parent 5021d2fe30
commit 0f0232c767
4 changed files with 55 additions and 64 deletions
+37 -50
View File
@@ -338,7 +338,7 @@ Layer::RemoveSelf()
bool bool
Layer::HasChild(Layer* layer) Layer::HasChild(Layer* layer)
{ {
for (Layer *lay = VirtualTopChild(); lay; lay = VirtualLowerSibling()) { for (Layer *lay = TopChild(); lay; lay = LowerSibling()) {
if (lay == layer) if (lay == layer)
return true; return true;
} }
@@ -350,9 +350,9 @@ uint32
Layer::CountChildren(void) const Layer::CountChildren(void) const
{ {
uint32 count = 0; uint32 count = 0;
Layer *lay = VirtualTopChild(); Layer *lay = TopChild();
while (lay != NULL) { while (lay != NULL) {
lay = VirtualLowerSibling(); lay = LowerSibling();
count++; count++;
} }
return count; return count;
@@ -371,13 +371,13 @@ Layer::FindLayer(const int32 token)
Layer* trylay; Layer* trylay;
// Search child layers first // Search child layers first
for (lay = VirtualTopChild(); lay; lay = VirtualLowerSibling()) { for (lay = TopChild(); lay; lay = LowerSibling()) {
if (lay->fViewToken == token) if (lay->fViewToken == token)
return lay; return lay;
} }
// Hmmm... not in this layer's children. Try lower descendants // Hmmm... not in this layer's children. Try lower descendants
for (lay = VirtualTopChild(); lay != NULL; lay = VirtualLowerSibling()) { for (lay = TopChild(); lay != NULL; lay = LowerSibling()) {
trylay = lay->FindLayer(token); trylay = lay->FindLayer(token);
if (trylay) if (trylay)
return trylay; return trylay;
@@ -401,7 +401,7 @@ Layer::LayerAt(const BPoint &pt)
if (fFullVisible.Contains(pt)) { if (fFullVisible.Contains(pt)) {
Layer *lay = NULL; Layer *lay = NULL;
for (Layer* child = VirtualBottomChild(); child; child = VirtualUpperSibling()) { for (Layer* child = BottomChild(); child; child = UpperSibling()) {
lay = child->LayerAt(pt); lay = child->LayerAt(pt);
if (lay) if (lay)
return lay; return lay;
@@ -411,33 +411,33 @@ Layer::LayerAt(const BPoint &pt)
return NULL; return NULL;
} }
// VirtualTopChild // TopChild
Layer* Layer*
Layer::VirtualTopChild() const Layer::TopChild() const
{ {
fCurrent = fTopChild; fCurrent = fTopChild;
return fCurrent; return fCurrent;
} }
// VirtualLowerSibling // LowerSibling
Layer* Layer*
Layer::VirtualLowerSibling() const Layer::LowerSibling() const
{ {
fCurrent = fCurrent->fLowerSibling; fCurrent = fCurrent->fLowerSibling;
return fCurrent; return fCurrent;
} }
// VirtualUpperSibling // UpperSibling
Layer* Layer*
Layer::VirtualUpperSibling() const Layer::UpperSibling() const
{ {
fCurrent = fCurrent->fUpperSibling; fCurrent = fCurrent->fUpperSibling;
return fCurrent; return fCurrent;
} }
// VirtualBottomChild // BottomChild
Layer* Layer*
Layer::VirtualBottomChild() const Layer::BottomChild() const
{ {
fCurrent = fBottomChild; fCurrent = fBottomChild;
return fCurrent; return fCurrent;
@@ -483,7 +483,7 @@ Layer::StartRebuildRegions( const BRegion& reg, Layer *target, uint32 action, BP
fVisible = fFullVisible; fVisible = fFullVisible;
// Rebuild regions for children... // Rebuild regions for children...
for (Layer *lay = VirtualBottomChild(); lay; lay = VirtualUpperSibling()) { for (Layer *lay = BottomChild(); lay; lay = UpperSibling()) {
if (lay == target) if (lay == target)
lay->RebuildRegions(reg, action, pt, BPoint(0.0f, 0.0f)); lay->RebuildRegions(reg, action, pt, BPoint(0.0f, 0.0f));
else else
@@ -689,7 +689,7 @@ Layer::RebuildRegions( const BRegion& reg, uint32 action, BPoint pt, BPoint ptOf
} }
// Rebuild regions for children... // Rebuild regions for children...
for(Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()) for(Layer *lay = BottomChild(); lay != NULL; lay = UpperSibling())
lay->RebuildRegions(reg, newAction, newPt, newOffset); lay->RebuildRegions(reg, newAction, newPt, newOffset);
#ifdef DEBUG_LAYER_REBUILD #ifdef DEBUG_LAYER_REBUILD
@@ -1263,7 +1263,7 @@ Layer::PrintTree()
{ {
printf("\n Tree structure:\n"); printf("\n Tree structure:\n");
printf("\t%s\t%s\n", GetName(), IsHidden()? "Hidden": "NOT hidden"); printf("\t%s\t%s\n", GetName(), IsHidden()? "Hidden": "NOT hidden");
for(Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()) for(Layer *lay = BottomChild(); lay != NULL; lay = UpperSibling())
printf("\t%s\t%s\n", lay->GetName(), lay->IsHidden()? "Hidden": "NOT hidden"); printf("\t%s\t%s\n", lay->GetName(), lay->IsHidden()? "Hidden": "NOT hidden");
} }
@@ -1466,7 +1466,7 @@ if (fOwner->cnt != 1)
} }
} }
for (Layer *lay = VirtualBottomChild(); lay != NULL; lay = VirtualUpperSibling()) { for (Layer *lay = BottomChild(); lay != NULL; lay = UpperSibling()) {
if (lay == startFrom) if (lay == startFrom)
redraw = true; redraw = true;
@@ -1558,42 +1558,29 @@ Layer::SetOverlayBitmap(const ServerBitmap* bitmap)
fOverlayBitmap = bitmap; fOverlayBitmap = bitmap;
} }
#ifdef NEW_CLIPPING
/*
//! Sends a B_VIEW_MOVED message to the client BWindow
void void
Layer::SendViewMovedMsg() Layer::ConvertToScreen2(BRect* rect) const
{ {
if (fServerWin && fFlags & B_FRAME_EVENTS) { if (GetRootLayer())
BMessage msg; if (fParent) {
msg.what = B_VIEW_MOVED; rect->OffsetBy(-fOrigin.x, -fOrigin.y);
// TODO: system_time() ?!? rect->OffsetBy(fFrame.left, fFrame.top);
msg.AddInt64("when", real_time_clock_usecs());
msg.AddInt32("_token", fViewToken); fParent->ConvertToScreen2(rect);
msg.AddPoint("where", fFrame.LeftTop()); }
fServerWin->SendMessageToClient(&msg);
}
} }
//! Sends a B_VIEW_RESIZE message to the client BWindow
void void
Layer::SendViewResizedMsg() Layer::ConvertToScreen2(BRegion* reg) const
{ {
if (fServerWin && fFlags & B_FRAME_EVENTS) { if (GetRootLayer())
BMessage msg; if (fParent) {
msg.what = B_VIEW_RESIZED; reg->OffsetBy(-fOrigin.x, -fOrigin.y);
// TODO: system_time() ?!? reg->OffsetBy(fFrame.left, fFrame.top);
msg.AddInt64("when", real_time_clock_usecs());
msg.AddInt32("_token", fViewToken); fParent->ConvertToScreen2(reg);
msg.AddFloat("width", fFrame.Width()); }
msg.AddFloat("height", fFrame.Height()); }
#endif
// no need for that... it's here because of backward compatibility
msg.AddPoint("where", fFrame.LeftTop());
fServerWin->SendMessageToClient(&msg);
}
}
*/
+8 -4
View File
@@ -85,10 +85,10 @@ class Layer {
Layer* FindLayer(const int32 token); Layer* FindLayer(const int32 token);
Layer* LayerAt(const BPoint &pt); Layer* LayerAt(const BPoint &pt);
virtual Layer* VirtualTopChild() const; virtual Layer* TopChild() const;
virtual Layer* VirtualLowerSibling() const; virtual Layer* LowerSibling() const;
virtual Layer* VirtualUpperSibling() const; virtual Layer* UpperSibling() const;
virtual Layer* VirtualBottomChild() const; virtual Layer* BottomChild() const;
const char* GetName() const const char* GetName() const
{ return (fName) ? fName->String() : NULL; } { return (fName) ? fName->String() : NULL; }
@@ -206,6 +206,10 @@ class Layer {
void SetOverlayBitmap(const ServerBitmap* bitmap); void SetOverlayBitmap(const ServerBitmap* bitmap);
inline const ServerBitmap* OverlayBitmap() const inline const ServerBitmap* OverlayBitmap() const
{ return fOverlayBitmap; } { return fOverlayBitmap; }
#ifdef NEW_CLIPPING
void ConvertToScreen2(BRect* rect) const;
void ConvertToScreen2(BRegion* reg) const;
#endif
protected: protected:
friend class RootLayer; friend class RootLayer;
+6 -6
View File
@@ -445,7 +445,7 @@ RootLayer::ResizeBy(float x, float y)
Layer * Layer *
RootLayer::VirtualTopChild() const RootLayer::TopChild() const
{ {
fWinBorderIndex = fWinBorderCount-1; fWinBorderIndex = fWinBorderCount-1;
@@ -455,7 +455,7 @@ RootLayer::VirtualTopChild() const
return NULL; return NULL;
} }
Layer* RootLayer::VirtualLowerSibling() const Layer* RootLayer::LowerSibling() const
{ {
if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex > 0) if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex > 0)
return fWinBorderList[fWinBorderIndex--]; return fWinBorderList[fWinBorderIndex--];
@@ -463,7 +463,7 @@ Layer* RootLayer::VirtualLowerSibling() const
return NULL; return NULL;
} }
Layer* RootLayer::VirtualUpperSibling() const Layer* RootLayer::UpperSibling() const
{ {
if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex > 0) if (fWinBorderIndex < fWinBorderCount && fWinBorderIndex > 0)
return fWinBorderList[fWinBorderIndex++]; return fWinBorderList[fWinBorderIndex++];
@@ -471,7 +471,7 @@ Layer* RootLayer::VirtualUpperSibling() const
return NULL; return NULL;
} }
Layer* RootLayer::VirtualBottomChild() const Layer* RootLayer::BottomChild() const
{ {
fWinBorderIndex = 0; fWinBorderIndex = 0;
@@ -2069,10 +2069,10 @@ RootLayer::empty_visible_regions(Layer *layer)
layer->fFullVisible.MakeEmpty(); layer->fFullVisible.MakeEmpty();
layer->fVisible.MakeEmpty(); layer->fVisible.MakeEmpty();
child = layer->VirtualBottomChild(); child = layer->BottomChild();
while(child) { while(child) {
empty_visible_regions(child); empty_visible_regions(child);
child = layer->VirtualUpperSibling(); child = layer->UpperSibling();
} }
} }
+4 -4
View File
@@ -74,10 +74,10 @@ public:
virtual void ResizeBy(float x, float y); virtual void ResizeBy(float x, float y);
// For the active workspaces // For the active workspaces
virtual Layer* VirtualTopChild(void) const; virtual Layer* TopChild(void) const;
virtual Layer* VirtualLowerSibling(void) const; virtual Layer* LowerSibling(void) const;
virtual Layer* VirtualUpperSibling(void) const; virtual Layer* UpperSibling(void) const;
virtual Layer* VirtualBottomChild(void) const; virtual Layer* BottomChild(void) const;
void HideWinBorder(WinBorder* winBorder); void HideWinBorder(WinBorder* winBorder);
void ShowWinBorder(WinBorder* winBorder); void ShowWinBorder(WinBorder* winBorder);