diff --git a/headers/os/interface/Shape.h b/headers/os/interface/Shape.h index 7b6181be9c..b287ed5e3e 100644 --- a/headers/os/interface/Shape.h +++ b/headers/os/interface/Shape.h @@ -63,6 +63,7 @@ public: void Clear(); BRect Bounds() const; + BPoint CurrentPosition() const; status_t AddShape(const BShape* other); diff --git a/src/kits/interface/Shape.cpp b/src/kits/interface/Shape.cpp index 7dbbca64fa..3666d4face 100644 --- a/src/kits/interface/Shape.cpp +++ b/src/kits/interface/Shape.cpp @@ -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) {