KoShape* KisShapeToolHelper::createEllipseShape(const QRectF& rect)
{
    KoShape* shape;
    KoShapeFactoryBase *rectFactory = KoShapeRegistry::instance()->value("EllipseShape");
    if (rectFactory) {
        shape = rectFactory->createDefaultShape();
        shape->setSize(rect.size());
        shape->setPosition(rect.topLeft());
    } else {
        //Fallback if the plugin wasn't found
        KoPathShape* path = new KoPathShape();
        path->setShapeId(KoPathShapeId);

        QPointF rightMiddle = QPointF(rect.left() + rect.width(), rect.top() + rect.height() / 2);
        path->moveTo(rightMiddle);
        path->arcTo(rect.width() / 2, rect.height() / 2, 0, 360.0);
        path->close();
        path->normalize();
        shape = path;
    }
    return shape;
}