QskGradient::effectiveGradient moved to
QskBoxRenderer::effectiveFradient as its implementation is not correct for arcs
This commit is contained in:
parent
a989ff92c9
commit
e9947c17a0
@ -7,6 +7,7 @@
|
||||
|
||||
#include <QskGradient.h>
|
||||
#include <QskGradientDirection.h>
|
||||
#include <QskBoxRenderer.h>
|
||||
|
||||
QSK_QT_PRIVATE_BEGIN
|
||||
|
||||
@ -54,7 +55,7 @@ namespace
|
||||
{
|
||||
QQuickShapeGradient* shapeGradient = nullptr;
|
||||
|
||||
auto effectiveGradient = gradient.effectiveGradient();
|
||||
auto effectiveGradient = QskBoxRenderer::effectiveGradient( gradient );
|
||||
effectiveGradient.stretchTo( rect );
|
||||
|
||||
switch( static_cast< int >( effectiveGradient.type() ) )
|
||||
|
@ -722,21 +722,6 @@ void QskGradient::resetDirection()
|
||||
m_values[0] = m_values[1] = m_values[2] = m_values[3] = m_values[4] = 0.0;
|
||||
}
|
||||
|
||||
QskGradient QskGradient::effectiveGradient() const
|
||||
{
|
||||
if ( ( m_type == QskGradient::Stops ) || isMonochrome() )
|
||||
{
|
||||
// the shader for linear gradients is the fastest
|
||||
|
||||
QskGradient g = *this;
|
||||
g.setDirection( QskGradient::Linear );
|
||||
|
||||
return g;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
QGradient QskGradient::toQGradient() const
|
||||
{
|
||||
QGradient g;
|
||||
|
@ -152,8 +152,6 @@ class QSK_EXPORT QskGradient
|
||||
QskGradient stretchedTo( const QSizeF& ) const;
|
||||
QskGradient stretchedTo( const QRectF& ) const;
|
||||
|
||||
QskGradient effectiveGradient() const;
|
||||
|
||||
static QVariant interpolate( const QskGradient&,
|
||||
const QskGradient&, qreal progress );
|
||||
|
||||
|
@ -103,7 +103,7 @@ void QskBoxRectangleNode::updateFilling( const QRectF& rect,
|
||||
return;
|
||||
}
|
||||
|
||||
const auto fillGradient = gradient.effectiveGradient();
|
||||
const auto fillGradient = QskBoxRenderer::effectiveGradient( gradient );
|
||||
const auto shape = shapeMetrics.toAbsolute( rect.size() );
|
||||
|
||||
const bool coloredGeometry = hasHint( PreferColoredGeometry )
|
||||
@ -211,13 +211,13 @@ void QskBoxRectangleNode::updateBox( const QRectF& rect,
|
||||
if ( isDirty )
|
||||
{
|
||||
/*
|
||||
For monochrome border/fiiling with the same color we might be
|
||||
For monochrome border/filling with the same color we might be
|
||||
able to do QskFillNode::Monochrome. However this is not implemeted in
|
||||
QskBoxRenderer yet. TODO ...
|
||||
*/
|
||||
setColoring( QskFillNode::Polychrome );
|
||||
|
||||
auto fillGradient = gradient.effectiveGradient();
|
||||
auto fillGradient = QskBoxRenderer::effectiveGradient( gradient );
|
||||
if ( !QskBoxRenderer::isGradientSupported( fillGradient ) )
|
||||
{
|
||||
qWarning() << "QskBoxRenderer does not support radial/conic gradients";
|
||||
|
@ -231,3 +231,18 @@ void QskBoxRenderer::setColoredBorderAndFillLines( const QRectF& rect,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QskGradient QskBoxRenderer::effectiveGradient( const QskGradient& gradient )
|
||||
{
|
||||
if ( ( gradient.type() == QskGradient::Stops ) || gradient.isMonochrome() )
|
||||
{
|
||||
// the shader for linear gradients is the fastest
|
||||
|
||||
auto g = gradient;
|
||||
g.setDirection( QskGradient::Linear );
|
||||
|
||||
return g;
|
||||
}
|
||||
|
||||
return gradient;
|
||||
}
|
||||
|
@ -54,6 +54,8 @@ namespace QskBoxRenderer
|
||||
QSK_EXPORT void setColoredBorderAndFillLines( const QRectF&,
|
||||
const QskBoxShapeMetrics&, const QskBoxBorderMetrics&,
|
||||
const QskBoxBorderColors&, const QskGradient&, QSGGeometry& );
|
||||
|
||||
QSK_EXPORT QskGradient effectiveGradient( const QskGradient& );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user