diff options
Diffstat (limited to 'src/plugins/scenegraph/openvg')
-rw-r--r-- | src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp | 14 | ||||
-rw-r--r-- | src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.h | 2 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp b/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp index 0bd51cbf46..d728686248 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp +++ b/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.cpp @@ -176,6 +176,12 @@ void QSGOpenVGInternalRectangleNode::setGradientStops(const QGradientStops &stop m_fillDirty = true; } +void QSGOpenVGInternalRectangleNode::setGradientVertical(bool vertical) +{ + m_vertical = vertical; + m_fillDirty = true; +} + void QSGOpenVGInternalRectangleNode::setRadius(qreal radius) { m_radius = radius; @@ -242,13 +248,13 @@ void QSGOpenVGInternalRectangleNode::render() } else { // Linear Gradient vgSetParameteri(m_rectanglePaint, VG_PAINT_TYPE, VG_PAINT_TYPE_LINEAR_GRADIENT); - const VGfloat verticalLinearGradient[] = { - 0.0f, + const VGfloat linearGradient[] = { 0.0f, 0.0f, - static_cast<VGfloat>(m_rect.height()) + m_vertical ? 0.0f : static_cast<VGfloat>(m_rect.width()), + m_vertical ? static_cast<VGfloat>(m_rect.height()) : 0.0f }; - vgSetParameterfv(m_rectanglePaint, VG_PAINT_LINEAR_GRADIENT, 4, verticalLinearGradient); + vgSetParameterfv(m_rectanglePaint, VG_PAINT_LINEAR_GRADIENT, 4, linearGradient); vgSetParameteri(m_rectanglePaint, VG_PAINT_COLOR_RAMP_SPREAD_MODE, VG_COLOR_RAMP_SPREAD_PAD); vgSetParameteri(m_rectanglePaint, VG_PAINT_COLOR_RAMP_PREMULTIPLIED, false); diff --git a/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.h b/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.h index e8d25c94f8..86d2c3318c 100644 --- a/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.h +++ b/src/plugins/scenegraph/openvg/qsgopenvginternalrectanglenode.h @@ -59,6 +59,7 @@ public: void setPenColor(const QColor &color) override; void setPenWidth(qreal width) override; void setGradientStops(const QGradientStops &stops) override; + void setGradientVertical(bool vertical) override; void setRadius(qreal radius) override; void setAligned(bool aligned) override; void update() override; @@ -85,6 +86,7 @@ private: qreal m_penWidth = 0.0; qreal m_radius = 0.0; bool m_aligned = false; + bool m_vertical = true; QGradientStops m_gradientStops; VGPath m_rectanglePath; |