renamed a few members so that I don't have problems later. removed more methods/members

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13190 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-06-16 20:43:53 +00:00
parent 458a8cb6dd
commit 5fcce1f54b
5 changed files with 99 additions and 48 deletions
+61 -42
View File
@@ -83,14 +83,22 @@ Layer::Layer(BRect frame, const char* name, int32 token,
fCurrent(NULL),
// all regions (fVisible, fFullVisible, fFull) start empty
#ifndef NEW_CLIPPING
fVisible(),
fFullVisible(),
#else
fVisible2(),
fFullVisible2(),
#endif
#ifndef NEW_CLIPPING
fFull(),
#endif
#ifndef NEW_CLIPPING
fClipReg(&fVisible),
#else
fClipReg(&fVisible2),
#endif
fServerWin(NULL),
fName(new BString(name)),
fViewToken(token),
@@ -296,11 +304,11 @@ Layer::RemoveChild(Layer *layer)
// 2.3) we were removed from the main tree so clear our full region.
#ifndef NEW_CLIPPING
c->fFull.MakeEmpty();
#endif
// 2.4) clear fullVisible region.
c->fFullVisible.MakeEmpty();
// 2.5) we don't have a visible region anymore.
c->fVisible.MakeEmpty();
#endif
}
// tree parsing algorithm
@@ -407,6 +415,7 @@ Layer::FindLayer(const int32 token)
Layer*
Layer::LayerAt(const BPoint &pt)
{
#ifndef NEW_CLIPPING
if (fVisible.Contains(pt))
return this;
@@ -418,7 +427,7 @@ Layer::LayerAt(const BPoint &pt)
return lay;
}
}
#endif
return NULL;
}
@@ -931,9 +940,10 @@ Layer::Hide(bool invalidate)
return;
fHidden = true;
#ifndef NEW_CLIPPING
if (invalidate)
GetRootLayer()->GoInvalidate(this, fFullVisible);
#endif
}
//! Returns true if the layer is hidden
@@ -1271,7 +1281,9 @@ Layer::PrintNode()
printf("Bottom child: %s (%p)\n",fBottomChild->GetName(), fBottomChild);
else
printf("Bottom child: NULL\n");
#ifndef NEW_CLIPPING
printf("Visible Areas: "); fVisible.PrintToStream();
#endif
}
//! Prints the tree hierarchy from the current layer down
@@ -1349,12 +1361,12 @@ return;
}
#ifndef NEW_CLIPPING
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_MOVE, pt);
#endif
fDriver->CopyRegionList(&fRootLayer->fCopyRegList,
&fRootLayer->fCopyList,
fRootLayer->fCopyRegList.CountItems(),
&fFullVisible);
#endif
fParent->Redraw(fRootLayer->fRedrawReg, this);
@@ -1394,9 +1406,10 @@ return;
}
#ifndef NEW_CLIPPING
fParent->StartRebuildRegions(BRegion(rect), this, B_LAYER_RESIZE, pt);
#endif
fDriver->CopyRegionList(&fRootLayer->fCopyRegList, &fRootLayer->fCopyList, fRootLayer->fCopyRegList.CountItems(), &fFullVisible);
#endif
fParent->Redraw(fRootLayer->fRedrawReg, this);
SendViewCoordUpdateMsg();
@@ -1467,7 +1480,11 @@ Layer::RequestDraw(const BRegion &reg, Layer *startFrom)
if (HasClient() && IsTopLayer()) {
// calculate the minimum region/rectangle to be updated with
// a single message to the client.
BRegion updateReg(fFullVisible);
BRegion updateReg
#ifndef NEW_CLIPPING
(fFullVisible)
#endif
;
if (fFlags & B_FULL_UPDATE_ON_RESIZE
#ifndef NEW_CLIPPING
&& fFrameAction == B_LAYER_ACTION_RESIZE
@@ -1492,6 +1509,7 @@ if (fOwner->cnt != 1)
}
}
#ifndef NEW_CLIPPING
if (fVisible.CountRects() > 0) {
BRegion updateReg(fVisible);
// calculate the update region
@@ -1512,7 +1530,7 @@ if (fOwner->cnt != 1)
fDriver->ConstrainClippingRegion(NULL);
}
}
#endif
for (Layer *lay = BottomChild(); lay != NULL; lay = UpperSibling()) {
if (lay == startFrom)
redraw = true;
@@ -1520,12 +1538,13 @@ if (fOwner->cnt != 1)
if (redraw && !(lay->IsHidden())) {
// no need to go deeper if not even the FullVisible region intersects
// Update one.
#ifndef NEW_CLIPPING
BRegion common(lay->fFullVisible);
common.IntersectWith(&reg);
if (common.CountRects() > 0)
lay->RequestDraw(reg, NULL);
#endif
}
}
}
@@ -1639,7 +1658,7 @@ Layer::do_Hide()
if (fParent && !fParent->IsHidden() && GetRootLayer()) {
// save fullVisible so we know what to invalidate
BRegion invalid(fFullVisible);
BRegion invalid(fFullVisible2);
clear_visible_regions();
@@ -1666,7 +1685,7 @@ Layer::do_Show()
void
Layer::do_Invalidate(const BRegion &invalid, const Layer *startFrom)
{
BRegion localVisible(fFullVisible);
BRegion localVisible(fFullVisible2);
localVisible.IntersectWith(&invalid);
rebuild_visible_regions(invalid, localVisible,
startFrom? startFrom: BottomChild());
@@ -1762,7 +1781,7 @@ Layer::rezize_layer_redraw_more(BRegion &reg, float dx, float dy)
lay->ConvertToScreen2(&regZ);
// intersect that with this'(not lay's) fullVisible region
regZ.IntersectWith(&fFullVisible);
regZ.IntersectWith(&fFullVisible2);
reg.Include(&regZ);
lay->rezize_layer_redraw_more(reg,
@@ -1770,7 +1789,7 @@ Layer::rezize_layer_redraw_more(BRegion &reg, float dx, float dy)
(rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM? dy: 0);
// above, OR this:
// reg.Include(&lay->fFullVisible);
// reg.Include(&lay->fFullVisible2);
}
else
if (((rm & 0x0F0F) == (uint16)B_FOLLOW_RIGHT && dx != 0) ||
@@ -1778,7 +1797,7 @@ Layer::rezize_layer_redraw_more(BRegion &reg, float dx, float dy)
((rm & 0xF0F0) == (uint16)B_FOLLOW_BOTTOM && dy != 0)||
((rm & 0xF0F0) == (uint16)B_FOLLOW_V_CENTER && dy != 0))
{
reg.Include(&lay->fFullVisible);
reg.Include(&lay->fFullVisible2);
}
}
}
@@ -1793,8 +1812,8 @@ Layer::resize_layer_full_update_on_resize(BRegion &reg, float dx, float dy)
uint16 rm = lay->fResizeMode & 0x0000FFFF;
if ((rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT || (rm & 0xF0F0) == (uint16)B_FOLLOW_TOP_BOTTOM) {
if (lay->fFlags & B_FULL_UPDATE_ON_RESIZE && lay->fVisible.CountRects() > 0)
reg.Include(&lay->fVisible);
if (lay->fFlags & B_FULL_UPDATE_ON_RESIZE && lay->fVisible2.CountRects() > 0)
reg.Include(&lay->fVisible2);
lay->resize_layer_full_update_on_resize(reg,
(rm & 0x0F0F) == (uint16)B_FOLLOW_LEFT_RIGHT? dx: 0,
@@ -1817,9 +1836,9 @@ Layer::do_ResizeBy(float dx, float dy)
ResizedByHook(dx, dy, false); // manual
if (!IsHidden() && GetRootLayer()) {
BRegion oldFullVisible(fFullVisible);
BRegion oldFullVisible(fFullVisible2);
// this is required to invalidate the old border
BRegion oldVisible(fVisible);
BRegion oldVisible(fVisible2);
// in case they moved, bottom, right and center aligned layers must be redrawn
BRegion redrawMore;
@@ -1828,7 +1847,7 @@ Layer::do_ResizeBy(float dx, float dy)
// we'll invalidate the old area and the new, maxmial one.
BRegion invalid;
get_user_regions(invalid);
invalid.Include(&fFullVisible);
invalid.Include(&fFullVisible2);
clear_visible_regions();
@@ -1838,11 +1857,11 @@ Layer::do_ResizeBy(float dx, float dy)
// what's invalid, are the differences between to old and the new fullVisible region
// 1) in case we grow.
BRegion redrawReg(fFullVisible);
BRegion redrawReg(fFullVisible2);
redrawReg.Exclude(&oldFullVisible);
// 2) in case we shrink
BRegion redrawReg2(oldFullVisible);
redrawReg2.Exclude(&fFullVisible);
redrawReg2.Exclude(&fFullVisible2);
// 3) combine.
redrawReg.Include(&redrawReg2);
@@ -1855,10 +1874,10 @@ Layer::do_ResizeBy(float dx, float dy)
// add redrawReg to our RootLayer's redraw region.
GetRootLayer()->fRedrawReg.Include(&redrawReg);
// include layer's visible region in case we want a full update on resize
if (fFlags & B_FULL_UPDATE_ON_RESIZE && fVisible.Frame().IsValid()) {
if (fFlags & B_FULL_UPDATE_ON_RESIZE && fVisible2.Frame().IsValid()) {
resize_layer_full_update_on_resize(GetRootLayer()->fRedrawReg, dx, dy);
GetRootLayer()->fRedrawReg.Include(&fVisible);
GetRootLayer()->fRedrawReg.Include(&fVisible2);
GetRootLayer()->fRedrawReg.Include(&oldVisible);
}
// clear canvas and set invalid regions for affected WinBorders
@@ -1880,12 +1899,12 @@ void Layer::do_MoveBy(float dx, float dy)
MovedByHook(dx, dy);
if (!IsHidden() && GetRootLayer()) {
BRegion oldFullVisible(fFullVisible);
BRegion oldFullVisible(fFullVisible2);
// we'll invalidate the old position and the new, maxmial one.
BRegion invalid;
get_user_regions(invalid);
invalid.Include(&fFullVisible);
invalid.Include(&fFullVisible2);
clear_visible_regions();
@@ -1894,7 +1913,7 @@ void Layer::do_MoveBy(float dx, float dy)
// 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.
BRegion redrawReg(fFullVisible);
BRegion redrawReg(fFullVisible2);
redrawReg.Include(&oldFullVisible);
// offset to layer's new location so that we can calculate the common region.
@@ -1905,7 +1924,7 @@ void Layer::do_MoveBy(float dx, float dy)
// 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.
oldFullVisible.IntersectWith(&fFullVisible);
oldFullVisible.IntersectWith(&fFullVisible2);
// offset back and instruct the HW to do the actual copying.
oldFullVisible.OffsetBy(-dx, -dy);
@@ -1928,20 +1947,20 @@ Layer::do_ScrollBy(float dx, float dy)
if (!IsHidden() && GetRootLayer()) {
// set the region to be invalidated.
BRegion invalid(fFullVisible);
BRegion invalid(fFullVisible2);
clear_visible_regions();
rebuild_visible_regions(invalid, invalid, BottomChild());
// for the moment we say that the whole surface needs to be redraw.
BRegion redrawReg(fFullVisible);
BRegion redrawReg(fFullVisible2);
// offset old region so that we can start comparing.
invalid.OffsetBy(dx, dy);
// compute the common region. we'll use HW acc to copy this to the new location.
invalid.IntersectWith(&fFullVisible);
invalid.IntersectWith(&fFullVisible2);
// TODO: uncomment!!!
// GetRootLayer()->CopyRegion(&invalid, -dx, -dy);
@@ -1989,7 +2008,7 @@ Layer::get_user_regions(BRegion &reg)
void
Layer::do_RebuildVisibleRegions(const BRegion &invalid, const Layer *startFrom)
{
BRegion localVisible(fFullVisible);
BRegion localVisible(fFullVisible2);
localVisible.IntersectWith(&invalid);
rebuild_visible_regions(invalid, localVisible, startFrom);
}
@@ -2006,7 +2025,7 @@ Layer::rebuild_visible_regions(const BRegion &invalid,
// no need to go deeper if the parent doesn't have a visible region anymore
// and our fullVisible region is also empty.
if (!parentLocalVisible.Frame().IsValid() && !(fFullVisible.CountRects() > 0))
if (!parentLocalVisible.Frame().IsValid() && !(fFullVisible2.CountRects() > 0))
return;
bool fullRebuild = false;
@@ -2025,11 +2044,11 @@ Layer::rebuild_visible_regions(const BRegion &invalid,
common.IntersectWith(&parentLocalVisible);
// exclude the invalid region
fFullVisible.Exclude(&invalid);
fVisible.Exclude(&invalid);
fFullVisible2.Exclude(&invalid);
fVisible2.Exclude(&invalid);
// put in what's really visible
fFullVisible.Include(&common);
fFullVisible2.Include(&common);
// this is to allow a layer to hide some parts of itself so children
// won't take them.
@@ -2044,19 +2063,19 @@ Layer::rebuild_visible_regions(const BRegion &invalid,
lay->rebuild_visible_regions(invalid, common, lay->BottomChild());
// to let children know much they can take from parent's visible region
common.Exclude(&lay->fFullVisible);
common.Exclude(&lay->fFullVisible2);
// we've hidden some parts of our visible region from our children,
// and we must be in sysnc with this region too...
if (altered)
unalteredVisible.Exclude(&lay->fFullVisible);
unalteredVisible.Exclude(&lay->fFullVisible2);
}
// the visible region of this layer is what left after all its children took
// what they could.
if (altered)
fVisible.Include(&unalteredVisible);
fVisible2.Include(&unalteredVisible);
else
fVisible.Include(&common);
fVisible2.Include(&common);
}
bool
@@ -2070,11 +2089,11 @@ void
Layer::clear_visible_regions()
{
// OPT: maybe we should uncomment these lines for performance
//if (fFullVisible.CountRects() <= 0)
//if (fFullVisible2.CountRects() <= 0)
// return;
fVisible.MakeEmpty();
fFullVisible.MakeEmpty();
fVisible2.MakeEmpty();
fFullVisible2.MakeEmpty();
for (Layer *child = BottomChild(); child; child = UpperSibling())
child->clear_visible_regions();
}
+8 -1
View File
@@ -268,9 +268,16 @@ class Layer {
Layer* fBottomChild;
mutable Layer* fCurrent;
#ifndef NEW_CLIPPING
BRegion fVisible;
BRegion fFullVisible;
#else
private:
BRegion fVisible2;
BRegion fFullVisible2;
protected:
#endif
#ifndef NEW_CLIPPING
BRegion fFull;
#endif
+8 -1
View File
@@ -955,8 +955,10 @@ RootLayer::WinBorderAt(const BPoint& pt) const
{
for (int32 i = 0; i < fWinBorderCount; i++)
{
#ifndef NEW_CLIPPING
if (fWinBorderList[i]->fFullVisible.Contains(pt))
return fWinBorderList[i];
#endif
}
return NULL;
}
@@ -1536,10 +1538,12 @@ void RootLayer::KeyboardEventHandler(int32 code, BPrivate::PortLink& msg)
#ifdef APPSERVER_ROOTLAYER_SHOW_WORKSPACE_NUMBER
{
// to draw the current Workspace index on screen.
#ifndef NEW_CLIPPING
BRegion reg(fVisible);
fDriver->ConstrainClippingRegion(&reg);
Draw(reg.Frame());
fDriver->ConstrainClippingRegion(NULL);
#endif
}
#endif
@@ -2053,10 +2057,12 @@ RootLayer::draw_window_tab(WinBorder *exFocus)
if (exFocus && focus != exFocus) {
// TODO: this line is a hack, decorator is drawn twice.
#ifndef NEW_CLIPPING
BRegion reg(exFocus->fVisible);
if (focus)
reg.Include(&focus->fVisible);
redraw_layer(this, reg);
#endif
}
}
}
@@ -2068,9 +2074,10 @@ RootLayer::empty_visible_regions(Layer *layer)
// NOTE: first 'layer' must be a WinBorder
Layer *child;
#ifndef NEW_CLIPPING
layer->fFullVisible.MakeEmpty();
layer->fVisible.MakeEmpty();
#endif
child = layer->BottomChild();
while(child) {
empty_visible_regions(child);
+14 -3
View File
@@ -803,8 +803,9 @@ ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
fCurrentLayer->SetViewColor(RGBColor(c));
// TODO: this should not trigger redraw, no?!?
#ifndef NEW_CLIPPING
myRootLayer->GoRedraw(fCurrentLayer, fCurrentLayer->fVisible);
#endif
break;
}
case AS_LAYER_GET_COLORS:
@@ -939,8 +940,9 @@ ServerWindow::DispatchMessage(int32 code, BPrivate::LinkReceiver &link)
int32 noOfRects;
ld = fCurrentLayer->fLayerData;
#ifndef NEW_CLIPPING
reg = fCurrentLayer->ConvertFromParent(&(fCurrentLayer->fVisible));
#endif
if (ld->ClippingRegion())
reg.IntersectWith(ld->ClippingRegion());
@@ -1449,7 +1451,11 @@ void
ServerWindow::DispatchGraphicsMessage(int32 code, BPrivate::LinkReceiver &link)
{
fWinBorder->GetRootLayer()->Lock();
BRegion rreg(fCurrentLayer->fVisible);
BRegion rreg
#ifndef NEW_CLIPPING
(fCurrentLayer->fVisible)
#endif
;
if (fWinBorder->fInUpdate)
rreg.IntersectWith(&fWinBorder->yUpdateReg);
@@ -2055,9 +2061,12 @@ ServerWindow::_CopyBits(RootLayer* rootLayer, Layer* layer,
// are triggering BView::Draw() to be called
// and for these parts only.
#ifndef NEW_CLIPPING
// the region that is going to be copied
BRegion copyRegion(src);
// apply the current clipping of the layer
copyRegion.IntersectWith(&layer->fVisible);
// offset the region to the destination
@@ -2080,6 +2089,8 @@ ServerWindow::_CopyBits(RootLayer* rootLayer, Layer* layer,
// trigger the redraw
// rootLayer->GoRedraw(fWinBorder, invalidRegion);
rootLayer->RequestDraw(invalidRegion, fWinBorder);
#endif
}
+8 -1
View File
@@ -545,7 +545,11 @@ WinBorder::HighlightDecorator(bool active)
bool
WinBorder::HasPoint(const BPoint& pt) const
{
#ifndef NEW_CLIPPING
return fFullVisible.Contains(pt);
#else
return NULL;
#endif
}
// Unimplemented. Hook function for handling when system GUI colors change
@@ -643,9 +647,12 @@ WinBorder::QuietlySetFeel(int32 feel)
click_type
WinBorder::_ActionFor(const PointerEvent& event) const
{
#ifndef NEW_CLIPPING
if (fTopLayer->fFullVisible.Contains(event.where))
return DEC_NONE;
else if (fDecorator)
else
#endif
if (fDecorator)
return fDecorator->Clicked(event.where, event.buttons, event.modifiers);
else
return DEC_NONE;