resolving QskGradient::Stops depends on the shape and can't be resolved
in QskFillNode.
This commit is contained in:
parent
b6cd4a23d7
commit
a989ff92c9
@ -104,8 +104,17 @@ void QskArcRenderNode::updateFilling( const QRectF& rect,
|
||||
return;
|
||||
}
|
||||
|
||||
const bool coloredGeometry = hasHint( PreferColoredGeometry )
|
||||
&& QskArcRenderer::isGradientSupported( rect, metrics, gradient );
|
||||
bool coloredGeometry = hasHint( PreferColoredGeometry );
|
||||
if ( coloredGeometry )
|
||||
{
|
||||
// not all gradients are supported by the renderer
|
||||
coloredGeometry = QskArcRenderer::isGradientSupported( rect, metrics, gradient );
|
||||
}
|
||||
else
|
||||
{
|
||||
// QskGradient::Stops is specific for QskArcRenderer
|
||||
coloredGeometry = ( gradient.type() == QskGradient::Stops );
|
||||
}
|
||||
|
||||
bool dirtyGeometry = d->updateMetrics( rect, metrics, radial, borderWidth );
|
||||
bool dirtyMaterial = d->updateColors( QColor(), gradient );
|
||||
|
@ -458,6 +458,7 @@ bool QskArcRenderer::isGradientSupported( const QRectF& rect,
|
||||
}
|
||||
case QskGradient::Conic:
|
||||
{
|
||||
#if 0
|
||||
const auto direction = gradient.conicDirection();
|
||||
if ( direction.center() == rect.center() )
|
||||
{
|
||||
@ -470,6 +471,7 @@ bool QskArcRenderer::isGradientSupported( const QRectF& rect,
|
||||
*/
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
@ -572,7 +574,7 @@ void QskArcRenderer::setBorderLines( const QRectF& rect,
|
||||
return;
|
||||
}
|
||||
|
||||
const Renderer renderer( rect, metrics, radial, QskGradient(), 0 );
|
||||
const Renderer renderer( rect, metrics, radial, QskGradient(), QskRgb::Black );
|
||||
|
||||
const auto lines = qskAllocateLines( geometry, renderer.borderCount() );
|
||||
if ( lines )
|
||||
|
@ -136,10 +136,12 @@ void QskFillNode::setColoring( const QColor& color )
|
||||
{
|
||||
setColoring( Monochrome );
|
||||
|
||||
const auto colorRgb = color.toRgb();
|
||||
|
||||
auto mat = static_cast< QSGFlatColorMaterial* >( material() );
|
||||
if ( mat->color() != color )
|
||||
if ( mat->color() != colorRgb )
|
||||
{
|
||||
mat->setColor( color );
|
||||
mat->setColor( colorRgb );
|
||||
markDirty( QSGNode::DirtyMaterial );
|
||||
}
|
||||
}
|
||||
@ -148,16 +150,25 @@ void QskFillNode::setColoring( const QRectF& rect, const QskGradient& gradient )
|
||||
{
|
||||
if ( gradient.isMonochrome() )
|
||||
{
|
||||
setColoring( gradient.startColor().toRgb() );
|
||||
setColoring( gradient.startColor() );
|
||||
}
|
||||
else
|
||||
{
|
||||
const auto effectiveGradient = gradient.effectiveGradient();
|
||||
setColoring( qskColoring( effectiveGradient.type() ) );
|
||||
if ( gradient.type() == QskGradient::Stops )
|
||||
{
|
||||
qWarning() << "QskFillNode::setColoring:"
|
||||
<< "QskGradient::Stops is not supported, using the first color instead.";
|
||||
|
||||
auto mat = static_cast< QskGradientMaterial* >( material() );
|
||||
if ( mat->updateGradient( rect, effectiveGradient ) )
|
||||
markDirty( QSGNode::DirtyMaterial );
|
||||
setColoring( gradient.startColor() );
|
||||
}
|
||||
else
|
||||
{
|
||||
setColoring( qskColoring( gradient.type() ) );
|
||||
|
||||
auto mat = static_cast< QskGradientMaterial* >( material() );
|
||||
if ( mat->updateGradient( rect, gradient ) )
|
||||
markDirty( QSGNode::DirtyMaterial );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user