diff --git a/examples/boxes/main.cpp b/examples/boxes/main.cpp index 1eb0d9c0..9cacb1d6 100644 --- a/examples/boxes/main.cpp +++ b/examples/boxes/main.cpp @@ -421,7 +421,7 @@ static void addColoredBorderRectangles6( QskLinearBox* parent ) { 1.0, Qt::black } } ); QskGradient gradient3( Qt::green ); QskGradient gradient4( Qt::Vertical, Qt::magenta, Qt::cyan ); - box->setBorderGradients( gradient1, gradient2, gradient3, gradient4 ); + box->setBorderGradients( gradient3, gradient3, gradient3, gradient4 ); box->setShape( 30, Qt::AbsoluteSize ); } diff --git a/src/nodes/QskBoxRendererEllipse.cpp b/src/nodes/QskBoxRendererEllipse.cpp index 48d2ec67..b63b3cc8 100644 --- a/src/nodes/QskBoxRendererEllipse.cpp +++ b/src/nodes/QskBoxRendererEllipse.cpp @@ -99,6 +99,11 @@ namespace int m_stepCount; bool m_inverted; }; + + int colorsInGradient( const QskGradient& gradient ) + { + return gradient.isMonochrome() ? 1 : gradient.stops().count(); + } } namespace @@ -1224,13 +1229,15 @@ void QskBoxRenderer::renderRectellipse( const QRectF& rect, { borderLineCount = 4 * ( stepCount + 1 ) + 1; - const int additionalLines = -1 - + borderColors.gradient( Qsk::Left ).stops().count() - 1 - + borderColors.gradient( Qsk::Top ).stops().count() - 1 - + borderColors.gradient( Qsk::Right ).stops().count() - 1 - + borderColors.gradient( Qsk::Bottom ).stops().count() - 1; + const int additionalLines = + colorsInGradient( borderColors.gradient( Qsk::Left ) ) - 1 + + colorsInGradient( borderColors.gradient( Qsk::Top ) ) - 1 + + colorsInGradient( borderColors.gradient( Qsk::Right ) ) - 1 + + colorsInGradient( borderColors.gradient( Qsk::Bottom ) ) - 1; - borderLineCount += qMax( additionalLines, 0 ); + qDebug() << "additional lines:" << additionalLines; + + borderLineCount += additionalLines; } int lineCount = borderLineCount + fillLineCount;