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:
@@ -63,6 +63,7 @@ public:
|
|||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
BRect Bounds() const;
|
BRect Bounds() const;
|
||||||
|
BPoint CurrentPosition() const;
|
||||||
|
|
||||||
status_t AddShape(const BShape* other);
|
status_t AddShape(const BShape* other);
|
||||||
|
|
||||||
|
|||||||
@@ -301,13 +301,13 @@ BShape::Bounds() const
|
|||||||
if (data->ptCount == 0)
|
if (data->ptCount == 0)
|
||||||
return bounds;
|
return bounds;
|
||||||
|
|
||||||
|
// TODO: This implementation doesn't take into account curves at all.
|
||||||
bounds.left = data->ptList[0].x;
|
bounds.left = data->ptList[0].x;
|
||||||
bounds.top = data->ptList[0].y;
|
bounds.top = data->ptList[0].y;
|
||||||
bounds.right = data->ptList[0].x;
|
bounds.right = data->ptList[0].x;
|
||||||
bounds.bottom = data->ptList[0].y;
|
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)
|
if (bounds.left > data->ptList[i].x)
|
||||||
bounds.left = data->ptList[i].x;
|
bounds.left = data->ptList[i].x;
|
||||||
if (bounds.top > data->ptList[i].y)
|
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
|
status_t
|
||||||
BShape::AddShape(const BShape* otherShape)
|
BShape::AddShape(const BShape* otherShape)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user