diff --git a/src/nodes/QskBoxBasicStroker.cpp b/src/nodes/QskBoxBasicStroker.cpp index e1a006cf..b245ba5e 100644 --- a/src/nodes/QskBoxBasicStroker.cpp +++ b/src/nodes/QskBoxBasicStroker.cpp @@ -786,23 +786,15 @@ int QskBoxBasicStroker::fillCount() const if ( m_metrics.isInsideRounded ) { - const auto c = m_metrics.corners; - if ( m_metrics.preferredOrientation == Qt::Horizontal ) { - n += qMax( c[ Qt::TopLeftCorner ].innerStepCount(), - c[ Qt::BottomLeftCorner ].innerStepCount() ); - - n += qMax( c[ Qt::TopRightCorner ].innerStepCount(), - c[ Qt::BottomRightCorner ].innerStepCount() ); + n += m_metrics.innerStepCount( Qt::TopLeftCorner, Qt::BottomLeftCorner ); + n += m_metrics.innerStepCount( Qt::TopRightCorner, Qt::BottomRightCorner ); } else { - n += qMax( c[ Qt::TopLeftCorner ].innerStepCount(), - c[ Qt::TopRightCorner ].innerStepCount() ); - - n += qMax( c[ Qt::BottomLeftCorner ].innerStepCount(), - c[ Qt::BottomRightCorner ].innerStepCount() ); + n += m_metrics.innerStepCount( Qt::TopLeftCorner, Qt::TopRightCorner ); + n += m_metrics.innerStepCount( Qt::BottomLeftCorner, Qt::BottomRightCorner ); } } diff --git a/src/nodes/QskBoxGradientStroker.cpp b/src/nodes/QskBoxGradientStroker.cpp index b743a315..1f05301a 100644 --- a/src/nodes/QskBoxGradientStroker.cpp +++ b/src/nodes/QskBoxGradientStroker.cpp @@ -9,6 +9,15 @@ #include "QskBoxColorMap.h" #include "QskBoxMetrics.h" +static inline bool qskCanUseHVFiller( + const Qt::Orientations orientations, const QskLinearDirection& dir ) +{ + if ( !dir.isTilted() ) + return orientations & ( dir.isVertical() ? Qt::Vertical : Qt::Horizontal ); + + return false; +} + namespace { using namespace QskVertex; @@ -770,7 +779,7 @@ int QskBoxGradientStroker::lineCount() const if ( m_metrics.isInsideRounded ) { - if ( m_metrics.stepSymmetries && !m_dir.isTilted() ) + if ( qskCanUseHVFiller( m_metrics.stepSymmetries, m_dir ) ) { const QskBoxBasicStroker stroker( m_metrics, QskBoxBorderColors(), m_gradient ); n += stroker.fillCount(); @@ -804,7 +813,7 @@ void QskBoxGradientStroker::setLines( int lineCount, QskVertex::ColoredLine* lin if ( m_metrics.isInsideRounded ) { - if ( m_metrics.stepSymmetries && !m_dir.isTilted() ) + if ( qskCanUseHVFiller( m_metrics.stepSymmetries, m_dir ) ) { FillerHV filler( m_metrics ); effectiveCount = filler.setLines( m_gradient, lines ); diff --git a/src/nodes/QskBoxMetrics.cpp b/src/nodes/QskBoxMetrics.cpp index b4dd7109..2a9846a9 100644 --- a/src/nodes/QskBoxMetrics.cpp +++ b/src/nodes/QskBoxMetrics.cpp @@ -173,15 +173,6 @@ QskBoxMetrics::QskBoxMetrics( const QRectF& rect, } } - if ( stepSymmetries == Qt::Horizontal ) - { - preferredOrientation = Qt::Horizontal; - } - else if ( stepSymmetries == Qt::Vertical ) - { - preferredOrientation = Qt::Vertical; - } - else { const auto tl = corners[ Qt::TopLeftCorner ].innerStepCount(); const auto tr = corners[ Qt::TopRightCorner ].innerStepCount(); diff --git a/src/nodes/QskBoxMetrics.h b/src/nodes/QskBoxMetrics.h index e2bf19e8..0b515208 100644 --- a/src/nodes/QskBoxMetrics.h +++ b/src/nodes/QskBoxMetrics.h @@ -89,10 +89,7 @@ class QskBoxMetrics */ Qt::Orientations stepSymmetries; - /* - In case stepSymmetries indicates both directions the direction - that needs less steps is preferred. - */ + // the direction that needs less contour lines is preferred. Qt::Orientation preferredOrientation; };