Integrated the new clipping code. It compiles but it does not work yet. Do not worry, it's guarded by a #define :-)

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13161 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Adi Oanca
2005-06-15 20:36:43 +00:00
parent 4399fd6025
commit d41a1e80b8
4 changed files with 561 additions and 7 deletions
+56 -1
View File
@@ -127,7 +127,9 @@ WinBorder::WinBorder(const BRect &r,
fAdFlags = fAdFlags | B_LAYER_CHILDREN_DEPENDANT;
fFlags = B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE;
fEventMask = B_POINTER_EVENTS;
#ifdef NEW_CLIPPING
fRebuildDecRegion = true;
#endif
QuietlySetFeel(wfeel);
if (fFeel != B_NO_BORDER_WINDOW_LOOK) {
@@ -612,4 +614,57 @@ WinBorder::_ActionFor(const PointerEvent& event) const
return DEC_NONE;
}
#ifdef NEW_CLIPPING
void WinBorder::MovedByHook(float dx, float dy)
{
fDecRegion.OffsetBy(dx, dy);
}
void WinBorder::ResizedByHook(float dx, float dy, bool automatic)
{
fRebuildDecRegion = true;
}
void WinBorder::set_decorator_region(BRect bounds)
{
fRebuildDecRegion = false;
fDecRegion.MakeEmpty();
// NOTE: frame is in screen coords
fDecRegion.Include(BRect(bounds.left-4, bounds.top-4, bounds.right+4, bounds.top-1));
fDecRegion.Include(BRect(bounds.left-4, bounds.bottom+1, bounds.right+4, bounds.bottom+4));
fDecRegion.Include(BRect(bounds.left-4, bounds.top, bounds.left-1, bounds.bottom));
fDecRegion.Include(BRect(bounds.right+1, bounds.top, bounds.right+4, bounds.bottom));
// tab
fDecRegion.Include(BRect(bounds.left-4, bounds.top-4-10, bounds.left+bounds.Width()/2, bounds.top-4));
// resize rect
fDecRegion.Include(BRect(bounds.right-10, bounds.bottom-10, bounds.right, bounds.bottom));
}
bool WinBorder::alter_visible_for_children(BRegion &region)
{
region.Exclude(&fDecRegion);
return true;
}
void WinBorder::get_user_regions(BRegion &reg)
{
if (fRebuildDecRegion)
{
set_decorator_region(Bounds());
ConvertToScreen2(&fDecRegion);
}
BRect screenFrame(Bounds());
ConvertToScreen2(&screenFrame);
reg.Set(screenFrame);
BRegion screenReg(GetRootLayer()->Bounds());
reg.IntersectWith(&screenReg);
reg.Include(&fDecRegion);
}
#endif