wip
This commit is contained in:
parent
28f818b62a
commit
b17cabaa83
|
@ -20,6 +20,31 @@ class QskArcRenderNodePrivate final : public QskFillNodePrivate
|
|||
node->resetGeometry();
|
||||
}
|
||||
|
||||
inline bool updateHash( const QRectF& rect, const QskArcMetrics& metrics,
|
||||
bool radial, qreal borderWidth, const QColor& borderColor,
|
||||
const QskGradient& gradient )
|
||||
{
|
||||
QskHashValue value = 3496;
|
||||
|
||||
value = qHashBits( &rect, sizeof( QRectF ), value );
|
||||
value = metrics.hash( value );
|
||||
value = qHash( radial, value );
|
||||
value = qHash( borderWidth, value );
|
||||
value = qHashBits( &borderColor, sizeof( borderColor ), value );
|
||||
|
||||
if ( gradient.isVisible() )
|
||||
value = gradient.hash( value );
|
||||
|
||||
if ( hash != value )
|
||||
{
|
||||
hash = value;
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
QskHashValue hash = 0;
|
||||
};
|
||||
|
||||
|
@ -39,10 +64,45 @@ void QskArcRenderNode::updateFilling( const QRectF& rect,
|
|||
}
|
||||
|
||||
void QskArcRenderNode::updateFilling( const QRectF& rect,
|
||||
const QskArcMetrics& metrics, bool radial,
|
||||
const QskArcMetrics& arcMetrics, bool radial,
|
||||
qreal borderWidth, const QskGradient& gradient )
|
||||
{
|
||||
updateArc( rect, metrics, radial, borderWidth, QColor(), gradient );
|
||||
Q_D( QskArcRenderNode );
|
||||
|
||||
const auto metrics = arcMetrics.toAbsolute( rect.size() );
|
||||
const auto borderMax = 0.5 * metrics.thickness();
|
||||
|
||||
const bool hasFill = gradient.isVisible() && ( borderWidth < borderMax );
|
||||
const bool hasBorder = false;
|
||||
|
||||
if ( rect.isEmpty() || metrics.isNull() || !( hasFill || hasBorder ) )
|
||||
{
|
||||
d->resetNode( this );
|
||||
return;
|
||||
}
|
||||
|
||||
borderWidth = qMin( borderWidth, borderMax );
|
||||
|
||||
if ( !d->updateHash( rect, metrics, radial, borderWidth, QColor(), gradient ) )
|
||||
{
|
||||
d->resetNode( this );
|
||||
return;
|
||||
}
|
||||
|
||||
#if 1
|
||||
const bool coloredGeometry = hasHint( PreferColoredGeometry )
|
||||
&& QskArcRenderer::isGradientSupported( rect, metrics, gradient );
|
||||
Q_ASSERT( coloredGeometry ); // TODO ...
|
||||
#endif
|
||||
|
||||
auto& geometry = *this->geometry();
|
||||
|
||||
setColoring( QskFillNode::Polychrome );
|
||||
|
||||
QskArcRenderer::setColoredFillLines( rect, metrics, radial,
|
||||
borderWidth, gradient, geometry );
|
||||
|
||||
markDirty( QSGNode::DirtyGeometry );
|
||||
}
|
||||
|
||||
void QskArcRenderNode::updateBorder( const QRectF& rect,
|
||||
|
@ -73,19 +133,11 @@ void QskArcRenderNode::updateArc(
|
|||
|
||||
borderWidth = qMin( borderWidth, borderMax );
|
||||
|
||||
QskHashValue hash = 3496;
|
||||
|
||||
hash = qHashBits( &rect, sizeof( QRectF ), hash );
|
||||
hash = qHash( borderWidth, hash );
|
||||
hash = qHashBits( &borderColor, sizeof( borderColor ), hash );
|
||||
hash = metrics.hash( hash );
|
||||
hash = gradient.hash( hash );
|
||||
hash = qHash( radial, hash );
|
||||
|
||||
if ( hash == d->hash )
|
||||
if ( !d->updateHash( rect, metrics, radial, borderWidth, borderColor, gradient ) )
|
||||
{
|
||||
d->resetNode( this );
|
||||
return;
|
||||
|
||||
d->hash = hash;
|
||||
}
|
||||
|
||||
#if 1
|
||||
const bool coloredGeometry = hasHint( PreferColoredGeometry )
|
||||
|
|
|
@ -505,7 +505,7 @@ void QskArcRenderer::setColoredBorderLines( const QRectF& rect,
|
|||
}
|
||||
|
||||
void QskArcRenderer::setColoredFillLines( const QRectF& rect, const QskArcMetrics& metrics,
|
||||
bool radial, const QskGradient& gradient, QSGGeometry& geometry )
|
||||
bool radial, qreal borderWidth, const QskGradient& gradient, QSGGeometry& geometry )
|
||||
{
|
||||
geometry.setDrawingMode( QSGGeometry::DrawTriangleStrip );
|
||||
geometry.markVertexDataDirty();
|
||||
|
@ -520,7 +520,7 @@ void QskArcRenderer::setColoredFillLines( const QRectF& rect, const QskArcMetric
|
|||
|
||||
if ( const auto lines = qskAllocateColoredLines( geometry, renderer.fillCount() ) )
|
||||
{
|
||||
renderer.renderArc( metrics.thickness(), 0.0, lines,
|
||||
renderer.renderArc( metrics.thickness(), borderWidth, lines,
|
||||
static_cast< QskVertex::ColoredLine* >( nullptr ) );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,8 @@ namespace QskArcRenderer
|
|||
const QColor& borderColor, QSGGeometry& );
|
||||
|
||||
QSK_EXPORT void setColoredFillLines( const QRectF&,
|
||||
const QskArcMetrics&, bool radial, const QskGradient&, QSGGeometry& );
|
||||
const QskArcMetrics&, bool radial, qreal borderWidth,
|
||||
const QskGradient&, QSGGeometry& );
|
||||
|
||||
QSK_EXPORT void setColoredBorderAndFillLines( const QRectF&,
|
||||
const QskArcMetrics&, bool radial, qreal borderWidth,
|
||||
|
|
|
@ -21,7 +21,7 @@ class QskBoxRectangleNodePrivate final : public QskFillNodePrivate
|
|||
node->resetGeometry();
|
||||
}
|
||||
|
||||
bool updateMetrics( const QRectF& rect,
|
||||
inline bool updateMetrics( const QRectF& rect,
|
||||
const QskBoxShapeMetrics& shape, const QskBoxBorderMetrics& borderMetrics )
|
||||
{
|
||||
QskHashValue hash = 13000;
|
||||
|
@ -33,7 +33,8 @@ class QskBoxRectangleNodePrivate final : public QskFillNodePrivate
|
|||
return updateValue( m_metricsHash, hash );
|
||||
}
|
||||
|
||||
bool updateColors( const QskBoxBorderColors& borderColors, const QskGradient& gradient )
|
||||
inline bool updateColors(
|
||||
const QskBoxBorderColors& borderColors, const QskGradient& gradient )
|
||||
{
|
||||
QskHashValue hash = 13000;
|
||||
|
||||
|
|
Loading…
Reference in New Issue