better decisions for the direction of filling gradient lines
This commit is contained in:
parent
b8f198a97a
commit
126c276eac
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue