Renamed fVisible2 and fFullVisible2 to fVisible and fFullVisible.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14921 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-14 17:56:51 +00:00
parent 5df853ea79
commit a436bab2da
5 changed files with 58 additions and 64 deletions
+48 -54
View File
@@ -45,12 +45,6 @@ Layer::Layer(BRect frame, const char* name, int32 token,
: :
fName(name), fName(name),
fFrame(frame), fFrame(frame),
// fBoundsLeftTop(0.0, 0.0),
fVisible2(),
fFullVisible2(),
fDirtyForRebuild(),
fDrawingRegion(),
fDriver(driver), fDriver(driver),
fRootLayer(NULL), fRootLayer(NULL),
@@ -377,10 +371,10 @@ Layer::LayerAt(const BPoint &pt, bool recursive)
return NULL; return NULL;
} }
if (fVisible2.Contains(pt)) if (fVisible.Contains(pt))
return this; return this;
if (fFullVisible2.Contains(pt)) { if (fFullVisible.Contains(pt)) {
for (Layer* child = LastChild(); child; child = PreviousChild()) { for (Layer* child = LastChild(); child; child = PreviousChild()) {
if (Layer* layer = child->LayerAt(pt)) if (Layer* layer = child->LayerAt(pt))
return layer; return layer;
@@ -509,8 +503,8 @@ Layer::Hide(bool invalidate)
} }
fHidden = true; fHidden = true;
if (invalidate && fFullVisible2.CountRects() > 0) { if (invalidate && fFullVisible.CountRects() > 0) {
BRegion invalid(fFullVisible2); BRegion invalid(fFullVisible);
fParent->MarkForRebuild(invalid); fParent->MarkForRebuild(invalid);
GetRootLayer()->MarkForRedraw(invalid); GetRootLayer()->MarkForRedraw(invalid);
@@ -564,7 +558,7 @@ Layer::PopState()
//! Matches the BView call of the same name //! Matches the BView call of the same name
BRect BRect
Layer::Bounds(void) const Layer::Bounds() const
{ {
BRect r(fFrame); BRect r(fFrame);
// r.OffsetTo(fBoundsLeftTop); // r.OffsetTo(fBoundsLeftTop);
@@ -575,7 +569,7 @@ Layer::Bounds(void) const
//! Matches the BView call of the same name //! Matches the BView call of the same name
BRect BRect
Layer::Frame(void) const Layer::Frame() const
{ {
return fFrame; return fFrame;
} }
@@ -594,12 +588,12 @@ Layer::MoveBy(float x, float y)
if (fParent && !IsHidden() && GetRootLayer() && GetRootLayer()->Lock()) { if (fParent && !IsHidden() && GetRootLayer() && GetRootLayer()->Lock()) {
fFrame.OffsetBy(x, y); fFrame.OffsetBy(x, y);
BRegion oldFullVisible(fFullVisible2); BRegion oldFullVisible(fFullVisible);
// we'll invalidate the old position and the new, maxmial one. // we'll invalidate the old position and the new, maxmial one.
BRegion invalid; BRegion invalid;
GetOnScreenRegion(invalid); GetOnScreenRegion(invalid);
invalid.Include(&fFullVisible2); invalid.Include(&fFullVisible);
fParent->MarkForRebuild(invalid); fParent->MarkForRebuild(invalid);
fParent->TriggerRebuild(); fParent->TriggerRebuild();
@@ -607,7 +601,7 @@ Layer::MoveBy(float x, float y)
// done rebuilding regions, now copy common parts and redraw regions that became visible // done rebuilding regions, now copy common parts and redraw regions that became visible
// include the actual and the old fullVisible regions. later, we'll exclude the common parts. // include the actual and the old fullVisible regions. later, we'll exclude the common parts.
BRegion redrawReg(fFullVisible2); BRegion redrawReg(fFullVisible);
redrawReg.Include(&oldFullVisible); redrawReg.Include(&oldFullVisible);
// offset to layer's new location so that we can calculate the common region. // offset to layer's new location so that we can calculate the common region.
@@ -618,7 +612,7 @@ Layer::MoveBy(float x, float y)
// by intersecting the old fullVisible offseted to layer's new location, with the current // by intersecting the old fullVisible offseted to layer's new location, with the current
// fullVisible, we'll have the common region which can be copied using HW acceleration. // fullVisible, we'll have the common region which can be copied using HW acceleration.
oldFullVisible.IntersectWith(&fFullVisible2); oldFullVisible.IntersectWith(&fFullVisible);
// offset back and instruct the HW to do the actual copying. // offset back and instruct the HW to do the actual copying.
oldFullVisible.OffsetBy(-x, -y); oldFullVisible.OffsetBy(-x, -y);
@@ -663,9 +657,9 @@ Layer::ResizeBy(float x, float y)
for (Layer *child = LastChild(); child != NULL; child = PreviousChild()) for (Layer *child = LastChild(); child != NULL; child = PreviousChild())
child->_ResizeLayerFrameBy(x, y); child->_ResizeLayerFrameBy(x, y);
BRegion oldFullVisible(fFullVisible2); BRegion oldFullVisible(fFullVisible);
// this is required to invalidate the old border // this is required to invalidate the old border
BRegion oldVisible(fVisible2); BRegion oldVisible(fVisible);
// in case they moved, bottom, right and center aligned layers must be redrawn // in case they moved, bottom, right and center aligned layers must be redrawn
BRegion redrawMore; BRegion redrawMore;
@@ -674,7 +668,7 @@ Layer::ResizeBy(float x, float y)
// we'll invalidate the old area and the new, maxmial one. // we'll invalidate the old area and the new, maxmial one.
BRegion invalid; BRegion invalid;
GetOnScreenRegion(invalid); GetOnScreenRegion(invalid);
invalid.Include(&fFullVisible2); invalid.Include(&fFullVisible);
fParent->MarkForRebuild(invalid); fParent->MarkForRebuild(invalid);
fParent->TriggerRebuild(); fParent->TriggerRebuild();
@@ -683,11 +677,11 @@ Layer::ResizeBy(float x, float y)
// what's invalid, are the differences between to old and the new fullVisible region // what's invalid, are the differences between to old and the new fullVisible region
// 1) in case we grow. // 1) in case we grow.
BRegion redrawReg(fFullVisible2); BRegion redrawReg(fFullVisible);
redrawReg.Exclude(&oldFullVisible); redrawReg.Exclude(&oldFullVisible);
// 2) in case we shrink // 2) in case we shrink
BRegion redrawReg2(oldFullVisible); BRegion redrawReg2(oldFullVisible);
redrawReg2.Exclude(&fFullVisible2); redrawReg2.Exclude(&fFullVisible);
// 3) combine. // 3) combine.
redrawReg.Include(&redrawReg2); redrawReg.Include(&redrawReg2);
@@ -698,10 +692,10 @@ Layer::ResizeBy(float x, float y)
_RezizeLayerRedrawMore(redrawReg, x, y); _RezizeLayerRedrawMore(redrawReg, x, y);
// include layer's visible region in case we want a full update on resize // include layer's visible region in case we want a full update on resize
if (fFlags & B_FULL_UPDATE_ON_RESIZE && fVisible2.Frame().IsValid()) { if (fFlags & B_FULL_UPDATE_ON_RESIZE && fVisible.Frame().IsValid()) {
_ResizeLayerFullUpdateOnResize(redrawReg, x, y); _ResizeLayerFullUpdateOnResize(redrawReg, x, y);
redrawReg.Include(&fVisible2); redrawReg.Include(&fVisible);
redrawReg.Include(&oldVisible); redrawReg.Include(&oldVisible);
} }
@@ -743,20 +737,20 @@ Layer::ScrollBy(float x, float y)
fDrawState->OffsetOrigin(BPoint(x, y)); fDrawState->OffsetOrigin(BPoint(x, y));
// set the region to be invalidated. // set the region to be invalidated.
BRegion invalid(fFullVisible2); BRegion invalid(fFullVisible);
MarkForRebuild(invalid); MarkForRebuild(invalid);
TriggerRebuild(); TriggerRebuild();
// for the moment we say that the whole surface needs to be redraw. // for the moment we say that the whole surface needs to be redraw.
BRegion redrawReg(fFullVisible2); BRegion redrawReg(fFullVisible);
// offset old region so that we can start comparing. // offset old region so that we can start comparing.
invalid.OffsetBy(x, y); invalid.OffsetBy(x, y);
// compute the common region. we'll use HW acc to copy this to the new location. // compute the common region. we'll use HW acc to copy this to the new location.
invalid.IntersectWith(&fFullVisible2); invalid.IntersectWith(&fFullVisible);
GetDrawingEngine()->CopyRegion(&invalid, -x, -y); GetDrawingEngine()->CopyRegion(&invalid, -x, -y);
// common region goes back to its original location. then, by excluding // common region goes back to its original location. then, by excluding
@@ -976,12 +970,12 @@ Layer::do_CopyBits(BRect& src, BRect& dst, int32 xOffset, int32 yOffset) {
BRegion copyRegion(src); BRegion copyRegion(src);
// apply the current clipping of the layer // apply the current clipping of the layer
copyRegion.IntersectWith(&fVisible2); copyRegion.IntersectWith(&fVisible);
// offset the region to the destination // offset the region to the destination
// and apply the current clipping there as well // and apply the current clipping there as well
copyRegion.OffsetBy(xOffset, yOffset); copyRegion.OffsetBy(xOffset, yOffset);
copyRegion.IntersectWith(&fVisible2); copyRegion.IntersectWith(&fVisible);
// the region at the destination that needs invalidation // the region at the destination that needs invalidation
BRegion redrawReg(dst); BRegion redrawReg(dst);
@@ -989,7 +983,7 @@ Layer::do_CopyBits(BRect& src, BRect& dst, int32 xOffset, int32 yOffset) {
// TODO: quick fix for our scrolling problem. FIX THIS! // TODO: quick fix for our scrolling problem. FIX THIS!
// redrawReg.Exclude(&copyRegion); // redrawReg.Exclude(&copyRegion);
// apply the current clipping as well // apply the current clipping as well
redrawReg.IntersectWith(&fVisible2); redrawReg.IntersectWith(&fVisible);
// move the region back for the actual operation // move the region back for the actual operation
copyRegion.OffsetBy(-xOffset, -yOffset); copyRegion.OffsetBy(-xOffset, -yOffset);
@@ -1159,7 +1153,7 @@ Layer::do_Hide()
if (fParent && !fParent->IsHidden() && GetRootLayer()) { if (fParent && !fParent->IsHidden() && GetRootLayer()) {
// save fullVisible so we know what to invalidate // save fullVisible so we know what to invalidate
BRegion invalid(fFullVisible2); BRegion invalid(fFullVisible);
_ClearVisibleRegions(); _ClearVisibleRegions();
@@ -1305,7 +1299,7 @@ Layer::_RezizeLayerRedrawMore(BRegion &reg, float dx, float dy)
child->ConvertToScreen(&regZ); child->ConvertToScreen(&regZ);
// intersect that with this'(not child's) fullVisible region // intersect that with this'(not child's) fullVisible region
regZ.IntersectWith(&fFullVisible2); regZ.IntersectWith(&fFullVisible);
reg.Include(&regZ); reg.Include(&regZ);
child->_RezizeLayerRedrawMore(reg, child->_RezizeLayerRedrawMore(reg,
@@ -1313,12 +1307,12 @@ Layer::_RezizeLayerRedrawMore(BRegion &reg, float dx, float dy)
(rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM? dy: 0); (rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM? dy: 0);
// above, OR this: // above, OR this:
// reg.Include(&child->fFullVisible2); // reg.Include(&child->fFullVisible);
} else if (((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0) } else if (((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0)
|| ((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0) || ((rm & 0x0F0F) == (uint16)B_FOLLOW_H_CENTER && dx != 0)
|| ((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0) || ((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0)
|| ((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0)) { || ((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0)) {
reg.Include(&child->fFullVisible2); reg.Include(&child->fFullVisible);
} }
} }
} }
@@ -1334,8 +1328,8 @@ Layer::_ResizeLayerFullUpdateOnResize(BRegion &reg, float dx, float dy)
uint16 rm = child->fResizeMode & 0x0000FFFF; uint16 rm = child->fResizeMode & 0x0000FFFF;
if ((rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT || (rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM) { if ((rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT || (rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM) {
if (child->fFlags & B_FULL_UPDATE_ON_RESIZE && child->fVisible2.CountRects() > 0) if (child->fFlags & B_FULL_UPDATE_ON_RESIZE && child->fVisible.CountRects() > 0)
reg.Include(&child->fVisible2); reg.Include(&child->fVisible);
child->_ResizeLayerFullUpdateOnResize(reg, child->_ResizeLayerFullUpdateOnResize(reg,
(rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT? dx: 0, (rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT? dx: 0,
@@ -1383,7 +1377,7 @@ Layer::_RebuildVisibleRegions(const BRegion &invalid,
// no need to go deeper if the parent doesn't have a visible region anymore // no need to go deeper if the parent doesn't have a visible region anymore
// and our fullVisible region is also empty. // and our fullVisible region is also empty.
if (!parentLocalVisible.Frame().IsValid() && !(fFullVisible2.CountRects() > 0)) if (!parentLocalVisible.Frame().IsValid() && !(fFullVisible.CountRects() > 0))
return; return;
bool fullRebuild = false; bool fullRebuild = false;
@@ -1402,11 +1396,11 @@ Layer::_RebuildVisibleRegions(const BRegion &invalid,
common.IntersectWith(&parentLocalVisible); common.IntersectWith(&parentLocalVisible);
// exclude the invalid region // exclude the invalid region
fFullVisible2.Exclude(&invalid); fFullVisible.Exclude(&invalid);
fVisible2.Exclude(&invalid); fVisible.Exclude(&invalid);
// put in what's really visible // put in what's really visible
fFullVisible2.Include(&common); fFullVisible.Include(&common);
// allow this layer to hide some parts from its children // allow this layer to hide some parts from its children
_ReserveRegions(common); _ReserveRegions(common);
@@ -1419,11 +1413,11 @@ Layer::_RebuildVisibleRegions(const BRegion &invalid,
child->_RebuildVisibleRegions(invalid, common, child->LastChild()); child->_RebuildVisibleRegions(invalid, common, child->LastChild());
// to let children know much they can take from parent's visible region // to let children know much they can take from parent's visible region
common.Exclude(&child->fFullVisible2); common.Exclude(&child->fFullVisible);
} }
// include what's left after all children took what they could. // include what's left after all children took what they could.
fVisible2.Include(&common); fVisible.Include(&common);
*/ */
// NOTE: I modified this method for the moment because of some issues that I have // NOTE: I modified this method for the moment because of some issues that I have
@@ -1446,8 +1440,8 @@ Layer::_RebuildVisibleRegions(const BRegion &invalid,
// see how much you can take // see how much you can take
common.IntersectWith(&parentLocalVisible); common.IntersectWith(&parentLocalVisible);
fFullVisible2 = common; fFullVisible = common;
fVisible2.MakeEmpty(); fVisible.MakeEmpty();
// allow this layer to hide some parts from its children // allow this layer to hide some parts from its children
_ReserveRegions(common); _ReserveRegions(common);
@@ -1456,11 +1450,11 @@ Layer::_RebuildVisibleRegions(const BRegion &invalid,
child->_RebuildVisibleRegions(invalid, common, child->LastChild()); child->_RebuildVisibleRegions(invalid, common, child->LastChild());
// to let children know much they can take from parent's visible region // to let children know much they can take from parent's visible region
common.Exclude(&child->fFullVisible2); common.Exclude(&child->fFullVisible);
} }
// include what's left after all children took what they could. // include what's left after all children took what they could.
fVisible2.Include(&common); fVisible.Include(&common);
_RebuildDrawingRegion(); _RebuildDrawingRegion();
} }
@@ -1469,7 +1463,7 @@ Layer::_RebuildVisibleRegions(const BRegion &invalid,
void void
Layer::_RebuildDrawingRegion() Layer::_RebuildDrawingRegion()
{ {
fDrawingRegion = fVisible2; fDrawingRegion = fVisible;
// apply user clipping which is in native coordinate system // apply user clipping which is in native coordinate system
if (const BRegion* userClipping = fDrawState->ClippingRegion()) { if (const BRegion* userClipping = fDrawState->ClippingRegion()) {
BRegion screenUserClipping(*userClipping); BRegion screenUserClipping(*userClipping);
@@ -1488,11 +1482,11 @@ void
Layer::_ClearVisibleRegions() Layer::_ClearVisibleRegions()
{ {
// OPT: maybe we should uncomment these lines for performance // OPT: maybe we should uncomment these lines for performance
//if (fFullVisible2.CountRects() <= 0) //if (fFullVisible.CountRects() <= 0)
// return; // return;
fVisible2.MakeEmpty(); fVisible.MakeEmpty();
fFullVisible2.MakeEmpty(); fFullVisible.MakeEmpty();
for (Layer *child = LastChild(); child; child = PreviousChild()) for (Layer *child = LastChild(); child; child = PreviousChild())
child->_ClearVisibleRegions(); child->_ClearVisibleRegions();
} }
@@ -1515,7 +1509,7 @@ Layer::TriggerRebuild()
_GetAllRebuildDirty(&totalInvalidReg); _GetAllRebuildDirty(&totalInvalidReg);
if (totalInvalidReg.CountRects() > 0) { if (totalInvalidReg.CountRects() > 0) {
BRegion localFullVisible(fFullVisible2); BRegion localFullVisible(fFullVisible);
// localFullVisible.IntersectWith(&totalInvalidReg); // localFullVisible.IntersectWith(&totalInvalidReg);
@@ -1545,8 +1539,8 @@ Layer::_AllRedraw(const BRegion &invalid)
if (wb) if (wb)
wb->RequestClientRedraw(invalid); wb->RequestClientRedraw(invalid);
if (fVisible2.CountRects() > 0) { if (fVisible.CountRects() > 0) {
BRegion updateReg(fVisible2); BRegion updateReg(fVisible);
updateReg.IntersectWith(&invalid); updateReg.IntersectWith(&invalid);
if (updateReg.CountRects() > 0) { if (updateReg.CountRects() > 0) {
@@ -1558,7 +1552,7 @@ Layer::_AllRedraw(const BRegion &invalid)
for (Layer *child = LastChild(); child != NULL; child = PreviousChild()) { for (Layer *child = LastChild(); child != NULL; child = PreviousChild()) {
if (!(child->IsHidden())) { if (!(child->IsHidden())) {
BRegion common(child->fFullVisible2); BRegion common(child->fFullVisible);
common.IntersectWith(&invalid); common.IntersectWith(&invalid);
if (common.CountRects() > 0) if (common.CountRects() > 0)
+4 -4
View File
@@ -199,8 +199,8 @@ class Layer {
void SetUserClipping(const BRegion& region); void SetUserClipping(const BRegion& region);
// region is expected in layer coordinates // region is expected in layer coordinates
inline const BRegion& VisibleRegion() const { return fVisible2; } inline const BRegion& VisibleRegion() const { return fVisible; }
inline const BRegion& FullVisible() const { return fFullVisible2; } inline const BRegion& FullVisible() const { return fFullVisible; }
inline const BRegion& DrawingRegion() const { return fDrawingRegion; } inline const BRegion& DrawingRegion() const { return fDrawingRegion; }
virtual void GetOnScreenRegion(BRegion& region); virtual void GetOnScreenRegion(BRegion& region);
@@ -246,8 +246,8 @@ class Layer {
// value.) // value.)
// BPoint fBoundsLeftTop; // BPoint fBoundsLeftTop;
BRegion fVisible2; BRegion fVisible;
BRegion fFullVisible2; BRegion fFullVisible;
BRegion fDirtyForRebuild; BRegion fDirtyForRebuild;
BRegion fDrawingRegion; BRegion fDrawingRegion;
+4 -4
View File
@@ -198,8 +198,8 @@ RootLayer::WorkingThread(void *data)
oneRootLayer->Lock(); oneRootLayer->Lock();
// RootLayer starts with valid visible regions // RootLayer starts with valid visible regions
oneRootLayer->fFullVisible2.Set(oneRootLayer->Bounds()); oneRootLayer->fFullVisible.Set(oneRootLayer->Bounds());
oneRootLayer->fVisible2.Set(oneRootLayer->Bounds()); oneRootLayer->fVisible.Set(oneRootLayer->Bounds());
oneRootLayer->MarkForRebuild(oneRootLayer->Bounds()); oneRootLayer->MarkForRebuild(oneRootLayer->Bounds());
oneRootLayer->MarkForRedraw(oneRootLayer->Bounds()); oneRootLayer->MarkForRedraw(oneRootLayer->Bounds());
@@ -305,8 +305,8 @@ RootLayer::ResizeBy(float x, float y)
fFrame.right += x; fFrame.right += x;
fFrame.bottom += y; fFrame.bottom += y;
fFullVisible2.Set(Bounds()); fFullVisible.Set(Bounds());
fVisible2.Set(Bounds()); fVisible.Set(Bounds());
BRegion region(fFrame); BRegion region(fFrame);
MarkForRebuild(region); MarkForRebuild(region);
+1 -1
View File
@@ -513,7 +513,7 @@ ServerWindow::CreateLayerTree(BPrivate::LinkReceiver &link, Layer **_parent)
// TODO: rework the clipping stuff to remove RootLayer dependency and then // TODO: rework the clipping stuff to remove RootLayer dependency and then
// remove this hack: // remove this hack:
if (fWinBorder->IsOffscreenWindow()) { if (fWinBorder->IsOffscreenWindow()) {
newLayer->fVisible2.Set(newLayer->fFrame); newLayer->fVisible.Set(newLayer->fFrame);
} }
if (_parent) { if (_parent) {
+1 -1
View File
@@ -792,7 +792,7 @@ WinBorder::_ReserveRegions(BRegion &reg)
{ {
BRegion reserve(reg); BRegion reserve(reg);
reserve.IntersectWith(&fDecRegion); reserve.IntersectWith(&fDecRegion);
fVisible2.Include(&reserve); fVisible.Include(&reserve);
reg.Exclude(&reserve); reg.Exclude(&reserve);
} }