better dirty detection

This commit is contained in:
Uwe Rathmann 2024-09-23 15:46:15 +02:00
parent feabc1fd50
commit 2f629aaded
1 changed files with 18 additions and 15 deletions

View File

@ -109,11 +109,13 @@ void QskBoxRectangleNode::updateFilling( const QRectF& rect,
const bool coloredGeometry = hasHint( PreferColoredGeometry ) const bool coloredGeometry = hasHint( PreferColoredGeometry )
&& QskBoxRenderer::isGradientSupported( fillGradient ); && QskBoxRenderer::isGradientSupported( fillGradient );
const bool dirtyMetrics = d->updateMetrics( rect, shape, borderMetrics ); bool dirtyGeometry = d->updateMetrics( rect, shape, borderMetrics );
const bool dirtyColors = d->updateColors( QskBoxBorderColors(), fillGradient ) bool dirtyMaterial = d->updateColors( QskBoxBorderColors(), fillGradient );
|| ( coloredGeometry != isGeometryColored() );
if ( dirtyMetrics || dirtyColors ) if ( coloredGeometry != isGeometryColored() )
dirtyGeometry = dirtyMaterial = true;
if ( dirtyGeometry || dirtyMaterial )
{ {
if ( coloredGeometry ) if ( coloredGeometry )
{ {
@ -128,16 +130,15 @@ void QskBoxRectangleNode::updateFilling( const QRectF& rect,
{ {
if ( fillGradient.isMonochrome() ) if ( fillGradient.isMonochrome() )
{ {
if ( dirtyColors ) if ( dirtyMaterial )
setColoring( fillGradient.rgbStart() ); setColoring( fillGradient.rgbStart() );
} }
else else
{ {
// dirtyMetrics: the shader also depends on rect !
setColoring( rect, fillGradient ); setColoring( rect, fillGradient );
} }
if ( dirtyMetrics ) if ( dirtyGeometry )
{ {
QskBoxRenderer::setFillLines( QskBoxRenderer::setFillLines(
rect, shape, borderMetrics, *geometry() ); rect, shape, borderMetrics, *geometry() );
@ -163,11 +164,13 @@ void QskBoxRectangleNode::updateBorder( const QRectF& rect,
const bool coloredGeometry = hasHint( PreferColoredGeometry ) const bool coloredGeometry = hasHint( PreferColoredGeometry )
|| !borderColors.isMonochrome(); || !borderColors.isMonochrome();
const bool dirtyMetrics = d->updateMetrics( rect, shape, borderMetrics ); bool dirtyGeometry = d->updateMetrics( rect, shape, borderMetrics );
const bool dirtyColors = d->updateColors( borderColors, QskGradient() ) bool dirtyMaterial = d->updateColors( borderColors, QskGradient() );
|| ( coloredGeometry != isGeometryColored() );
if ( dirtyMetrics || dirtyColors ) if ( coloredGeometry != isGeometryColored() )
dirtyGeometry = dirtyMaterial = true;
if ( dirtyGeometry || dirtyMaterial )
{ {
if ( coloredGeometry ) if ( coloredGeometry )
{ {
@ -182,7 +185,7 @@ void QskBoxRectangleNode::updateBorder( const QRectF& rect,
{ {
setColoring( borderColors.left().rgbStart() ); setColoring( borderColors.left().rgbStart() );
if ( dirtyMetrics ) if ( dirtyGeometry )
{ {
QskBoxRenderer::setBorderLines( rect, shape, QskBoxRenderer::setBorderLines( rect, shape,
borderMetrics, *geometry() ); borderMetrics, *geometry() );
@ -210,10 +213,10 @@ void QskBoxRectangleNode::updateBox( const QRectF& rect,
if ( hasFill && hasBorder ) if ( hasFill && hasBorder )
{ {
const bool dirtyMetrics = d->updateMetrics( rect, shape, borderMetrics ); const bool isDirty = d->updateMetrics( rect, shape, borderMetrics )
const bool dirtyColors = d->updateColors( borderColors, gradient ); || d->updateColors( borderColors, gradient ) || !isGeometryColored();
if ( dirtyMetrics || dirtyColors ) if ( isDirty )
{ {
/* /*
For monochrome border/fiiling with the same color we might be For monochrome border/fiiling with the same color we might be