[interfacekit] BRect implementation

  • From: "burton666@xxxxxxxxx" <burton666@xxxxxxxxx>
  • To: "interfacekit" <interfacekit@xxxxxxxxxxxxx>
  • Date: Wed, 15 Oct 2003 13:40:33 +0200

I guess you already know that our current BRect implementation has a serious 
flaw 
(BRect::Intersects() return false if one rect completely contains the other 
one). I guess it's time to fix it. This is the code: blablabla. Can I commit 
it ?

This way we can get rid of things like:


if(TestRectIntersection(Bounds(),rect))

(should be rect.Intersects(Bounds())

and

        // Clip the rectangle to the _visible region of the layer
        if(TestRegionIntersection(_visible,rect))
        {


BTW, I noticed also some things like:

BRegion Layer::ConvertToParent(BRegion *reg)
{
    BRegion newreg;
    for(int32 i=0; i<reg->CountRects(); i++)
        newreg.Include( (reg->RectAt(i)).OffsetByCopy(_frame.LeftTop()) );
    return newreg;
}

there's no need to iterate over all the rects of the region to offset them.
There is already BRegion::OffsetBy() which can do the work.




Other related posts: