Added BShape::CurrentPoint(), returning the current end point of the path.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35908 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2010-03-19 00:28:38 +00:00
parent cfefeee3f8
commit 00873f7818
2 changed files with 15 additions and 2 deletions

View File

@ -63,6 +63,7 @@ public:
void Clear();
BRect Bounds() const;
BPoint CurrentPosition() const;
status_t AddShape(const BShape* other);

View File

@ -301,13 +301,13 @@ BShape::Bounds() const
if (data->ptCount == 0)
return bounds;
// TODO: This implementation doesn't take into account curves at all.
bounds.left = data->ptList[0].x;
bounds.top = data->ptList[0].y;
bounds.right = data->ptList[0].x;
bounds.bottom = data->ptList[0].y;
for (int32 i = 1; i < data->ptCount; i++)
{
for (int32 i = 1; i < data->ptCount; i++) {
if (bounds.left > data->ptList[i].x)
bounds.left = data->ptList[i].x;
if (bounds.top > data->ptList[i].y)
@ -322,6 +322,18 @@ BShape::Bounds() const
}
BPoint
BShape::CurrentPosition() const
{
shape_data* data = (shape_data*)fPrivateData;
if (data->ptCount == 0)
return B_ORIGIN;
return data->ptList[data->ptCount - 1];
}
status_t
BShape::AddShape(const BShape* otherShape)
{