diff options
author | Lars Knoll <lars.knoll@qt.io> | 2017-11-08 10:28:30 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2017-11-08 12:32:01 +0100 |
commit | 0a27a14ec1879096e5fffca75b3bd107b813db87 (patch) | |
tree | 2e4332c9545af969903cb9c8bd619f2adc53f5a8 /src/imports/shapes | |
parent | b853a1e1b003d4dc01884201c09c2fcbf75f2cf6 (diff) | |
parent | 7bedd55551fbe95355b0db11f9d576924e829f9d (diff) |
Merge remote-tracking branch 'origin/dev' into new-backend
Change-Id: I1a49b4a242ed0764101521d06ec612e96bff0e4c
Diffstat (limited to 'src/imports/shapes')
-rw-r--r-- | src/imports/shapes/qquickshapenvprrenderer.cpp | 25 | ||||
-rw-r--r-- | src/imports/shapes/shapes.pro | 2 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/imports/shapes/qquickshapenvprrenderer.cpp b/src/imports/shapes/qquickshapenvprrenderer.cpp index c0a918bda5..88f367fe70 100644 --- a/src/imports/shapes/qquickshapenvprrenderer.cpp +++ b/src/imports/shapes/qquickshapenvprrenderer.cpp @@ -43,6 +43,7 @@ #include <QOpenGLShaderProgram> #include <QOpenGLBuffer> #include <qmath.h> +#include <private/qpainterpath_p.h> #include <private/qquickpath_p_p.h> QT_BEGIN_NAMESPACE @@ -287,6 +288,30 @@ void QQuickShapeNvprRenderer::convertPath(const QQuickPath *path, ShapePathGuiDa if (d->path.str.isEmpty()) d->path.str = QString(QStringLiteral("M %1 %2 ")).arg(pos.x()).arg(pos.y()).toUtf8(); d->path.str.append(o->path().toUtf8()); + } else if (QQuickPathAngleArc *o = qobject_cast<QQuickPathAngleArc *>(e)) { + QRectF rect(o->centerX() - o->radiusX(), o->centerY() - o->radiusY(), o->radiusX() * 2, o->radiusY() * 2); + QPointF startPoint; + QPointF endPoint; + qt_find_ellipse_coords(rect, o->startAngle(), -o->sweepAngle(), &startPoint, &endPoint); + + // get to our starting position + if (o->moveToStart()) + d->path.cmd.append(GL_MOVE_TO_NV); + else + d->path.cmd.append(GL_LINE_TO_NV); // ### should we check if startPoint == pos? + d->path.coord.append(startPoint.x()); + d->path.coord.append(startPoint.y()); + + const bool sweepFlag = o->sweepAngle() > 0; // maps to CCW, not a typo + d->path.cmd.append(qAbs(o->sweepAngle()) > 180.0 + ? (sweepFlag ? GL_LARGE_CCW_ARC_TO_NV : GL_LARGE_CW_ARC_TO_NV) + : (sweepFlag ? GL_SMALL_CCW_ARC_TO_NV : GL_SMALL_CW_ARC_TO_NV)); + d->path.coord.append(o->radiusX()); + d->path.coord.append(o->radiusY()); + d->path.coord.append(0); // xAxisRotation + d->path.coord.append(endPoint.x()); + d->path.coord.append(endPoint.y()); + pos = endPoint; } else { qWarning() << "Shape/NVPR: unsupported Path element" << e; } diff --git a/src/imports/shapes/shapes.pro b/src/imports/shapes/shapes.pro index 4406474c3f..60cc61e974 100644 --- a/src/imports/shapes/shapes.pro +++ b/src/imports/shapes/shapes.pro @@ -3,7 +3,7 @@ TARGET = qmlshapesplugin TARGETPATH = QtQuick/Shapes IMPORT_VERSION = 1.0 -QT = core gui qml quick quick-private +QT = core gui-private qml quick-private HEADERS += \ qquickshape_p.h \ |