public bool IsVisible(RectangleF rect)
{
if (rects.Length > 0 && extent.IntersectsWith(rect))
{
for (int i = 0; i < rects.Length; i++)
{
RectangleF currentRect = rects[i];
// Not far enough down yet
if (currentRect.Bottom <= rect.Top)
{
continue;
}
// Too far down
if (currentRect.Top >= rect.Bottom)
{
break;
}
// Not far over enough yet
if (currentRect.Right <= rect.Left)
{
continue;
}
if (currentRect.Left >= rect.Right)
{
continue;
}
return(true);
}
}
return(false);
}