Added to Utils a function to compute polygon boundaries
Moved Utils to libappserver - DisplaySupport needs it Tweaked PicturePlayer to match polygon function tweaks Added Shape, Region, and Polygon handling to ServerWindow Removed ServerWindow::DispatchGraphicsMessage Numerous small tweaks to DisplayDriver git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8991 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -301,3 +301,27 @@ status_t ConvertModeToDisplayMode(uint32 mode, display_mode *dmode)
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
BRect CalculatePolygonBounds(BPoint *pts, int32 pointcount)
|
||||
{
|
||||
if(!pts)
|
||||
return BRect(0,0,0,0);
|
||||
|
||||
BRect r(0,0,0,0);
|
||||
|
||||
// shamelessly stolen from Marc's BPolygon code and tweaked to fit. :P
|
||||
r = BRect(pts[0], pts[0]);
|
||||
|
||||
for (int32 i = 1; i < 4; i++)
|
||||
{
|
||||
if (pts[i].x < r.left)
|
||||
r.left = pts[i].x;
|
||||
if (pts[i].y < r.top)
|
||||
r.top = pts[i].y;
|
||||
if (pts[i].x > r.right)
|
||||
r.right = pts[i].x;
|
||||
if (pts[i].y > r.bottom)
|
||||
r.bottom = pts[i].y;
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user