corner -> corners

This commit is contained in:
Uwe Rathmann 2023-01-24 19:49:15 +01:00
parent 83ce3dbbf9
commit 910a8a730f
4 changed files with 50 additions and 50 deletions

View File

@ -61,7 +61,7 @@ namespace
qreal xt, yt;
{
const auto& c = m.corner[ Qt::TopLeftCorner ];
const auto& c = m.corners[ Qt::TopLeftCorner ];
const qreal k = c.radiusInnerY / c.radiusInnerX * md;
const qreal u = ::sqrt( 1.0 + k * k );
@ -152,12 +152,12 @@ namespace
if ( clockwise )
{
if ( x2 >= metrics.corner[ Qt::TopRightCorner ].centerX )
if ( x2 >= metrics.corners[ Qt::TopRightCorner ].centerX )
setCorner( Qt::TopRightCorner, metrics );
}
else
{
if ( y2 >= metrics.corner[ Qt::BottomLeftCorner ].centerY )
if ( y2 >= metrics.corners[ Qt::BottomLeftCorner ].centerY )
setCorner( Qt::BottomLeftCorner, metrics );
}
}
@ -177,7 +177,7 @@ namespace
using namespace Qt;
const auto& corners = metrics.corner;
const auto& corners = metrics.corners;
const auto& c = corners[ m_corner ];
m_contourLine.p1 = m_contourLine.p2;
@ -324,7 +324,7 @@ namespace
Qt::Corner corner, const QskRoundedRect::Metrics& metrics )
{
m_corner = corner;
const auto& c = metrics.corner[ corner ];
const auto& c = metrics.corners[ corner ];
const double angleStep = M_PI_2 / c.stepCount;
@ -420,7 +420,7 @@ namespace
: m_metrics( metrics )
, m_curve( curve )
{
const auto& c = metrics.corner[ Qt::TopLeftCorner ];
const auto& c = metrics.corners[ Qt::TopLeftCorner ];
#if 1
// This does not need to be done twice !!!

View File

@ -118,7 +118,7 @@ QskRoundedRect::Metrics::Metrics( const QRectF& rect,
for ( int i = 0; i < 4; i++ )
{
auto& c = corner[ i ];
auto& c = corners[ i ];
const QSizeF radius = shape.radius( static_cast< Qt::Corner >( i ) );
c.radiusX = qBound( 0.0, radius.width(), 0.5 * outerQuad.width );
@ -149,17 +149,17 @@ QskRoundedRect::Metrics::Metrics( const QRectF& rect,
}
}
centerQuad.left = qMax( corner[ TopLeft ].centerX,
corner[ BottomLeft ].centerX );
centerQuad.left = qMax( corners[ TopLeft ].centerX,
corners[ BottomLeft ].centerX );
centerQuad.right = qMin( corner[ TopRight ].centerX,
corner[ BottomRight ].centerX );
centerQuad.right = qMin( corners[ TopRight ].centerX,
corners[ BottomRight ].centerX );
centerQuad.top = qMax( corner[ TopLeft ].centerY,
corner[ TopRight ].centerY );
centerQuad.top = qMax( corners[ TopLeft ].centerY,
corners[ TopRight ].centerY );
centerQuad.bottom = qMin( corner[ BottomLeft ].centerY,
corner[ BottomRight ].centerY );
centerQuad.bottom = qMin( corners[ BottomLeft ].centerY,
corners[ BottomRight ].centerY );
centerQuad.width = centerQuad.right - centerQuad.left;
centerQuad.height = centerQuad.bottom - centerQuad.top;
@ -200,7 +200,7 @@ QskRoundedRect::Metrics::Metrics( const QRectF& rect,
for ( int i = 0; i < 4; i++ )
{
auto& c = corner[ i ];
auto& c = corners[ i ];
switch ( i )
{
@ -245,10 +245,10 @@ QskRoundedRect::Metrics::Metrics( const QRectF& rect,
}
isTotallyCropped =
corner[ TopLeft ].isCropped &&
corner[ TopRight ].isCropped &&
corner[ BottomRight ].isCropped &&
corner[ BottomLeft ].isCropped;
corners[ TopLeft ].isCropped &&
corners[ TopRight ].isCropped &&
corners[ BottomRight ].isCropped &&
corners[ BottomLeft ].isCropped;
// number of steps for iterating over the corners
@ -264,7 +264,7 @@ QskRoundedRect::BorderValues::BorderValues( const QskRoundedRect::Metrics& metri
{
if ( m_isUniform )
{
const auto& c = metrics.corner[ 0 ];
const auto& c = metrics.corners[ 0 ];
m_uniform.dx1 = c.radiusInnerX;
m_uniform.dy1 = c.radiusInnerY;
@ -273,7 +273,7 @@ QskRoundedRect::BorderValues::BorderValues( const QskRoundedRect::Metrics& metri
{
for ( int i = 0; i < 4; i++ )
{
const auto& c = metrics.corner[ i ];
const auto& c = metrics.corners[ i ];
auto& inner = m_multi.inner[ i ];
auto& outer = m_multi.outer[ i ];
@ -313,7 +313,7 @@ void QskRoundedRect::BorderValues::setAngle( qreal cos, qreal sin )
{
if ( m_isUniform )
{
const auto& c = m_metrics.corner[ 0 ];
const auto& c = m_metrics.corners[ 0 ];
if ( !c.isCropped )
{
@ -356,7 +356,7 @@ void QskRoundedRect::Stroker::setBorderGradientLines(
QskVertex::Line from, to;
const auto& c = m_metrics.corner;
const auto& c = m_metrics.corners;
switch( c1 )
{
@ -456,7 +456,7 @@ void QskRoundedRect::Stroker::createBorderLines( QskVertex::Line* lines ) const
{
Q_ASSERT( m_metrics.isRadiusRegular );
const auto& c = m_metrics.corner;
const auto& c = m_metrics.corners;
const int stepCount = c[ 0 ].stepCount;
const int numCornerLines = stepCount + 1;
@ -531,7 +531,7 @@ void QskRoundedRect::Stroker::createFillLines(
ColorMap fillMap( gradient );
const auto& c = m_metrics.corner;
const auto& c = m_metrics.corners;
const int stepCount = c[ 0 ].stepCount;
int numLines = 2 * stepCount + 1;
@ -603,7 +603,7 @@ void QskRoundedRect::Stroker::createBorderLines(
Qt::Orientation orientation, QskVertex::ColoredLine* lines,
const QskBoxBorderColors& colors ) const
{
const auto& c = m_metrics.corner;
const auto& c = m_metrics.corners;
#if 1
const int stepCount = c[ 0 ].stepCount;
#endif
@ -720,7 +720,7 @@ void QskRoundedRect::Stroker::createUniformBox(
const ColorMap fillMap( gradient );
const auto& c = m_metrics.corner;
const auto& c = m_metrics.corners;
const int stepCount = c[ 0 ].stepCount;
const BorderMaps borderMaps( stepCount, borderColors );

View File

@ -43,7 +43,7 @@ namespace QskRoundedRect
int stepCount;
} corner[ 4 ];
} corners[ 4 ];
bool isBorderRegular;
bool isRadiusRegular;

View File

@ -79,12 +79,12 @@ namespace
m_dt = vector.dx() * m_size;
}
const auto& mc1 = metrics.corner[ c[0] ];
const auto& mc2 = metrics.corner[ c[1] ];
const auto& mc1 = metrics.corners[ c[0] ];
const auto& mc2 = metrics.corners[ c[1] ];
const auto& mc3 = ( mc1.stepCount >= mc2.stepCount ) ? mc1 : mc2;
const auto& mc4 = metrics.corner[ c[2] ];
const auto& mc5 = metrics.corner[ c[3] ];
const auto& mc4 = metrics.corners[ c[2] ];
const auto& mc5 = metrics.corners[ c[3] ];
const auto& mc6 = ( mc4.stepCount >= mc5.stepCount ) ? mc4 : mc5;
m_vector[0] = vectorAt( !m_vertical, false, mc1 );
@ -265,29 +265,29 @@ static inline int qskFillLineCount(
if ( dir.isVertical() )
{
lineCount += qMax( metrics.corner[ TopLeft ].stepCount,
metrics.corner[ TopRight ].stepCount ) + 1;
lineCount += qMax( metrics.corners[ TopLeft ].stepCount,
metrics.corners[ TopRight ].stepCount ) + 1;
lineCount += qMax( metrics.corner[ BottomLeft ].stepCount,
metrics.corner[ BottomRight ].stepCount ) + 1;
lineCount += qMax( metrics.corners[ BottomLeft ].stepCount,
metrics.corners[ BottomRight ].stepCount ) + 1;
if ( metrics.centerQuad.top >= metrics.centerQuad.bottom )
lineCount--;
}
else if ( dir.isHorizontal() )
{
lineCount += qMax( metrics.corner[ TopLeft ].stepCount,
metrics.corner[ BottomLeft ].stepCount ) + 1;
lineCount += qMax( metrics.corners[ TopLeft ].stepCount,
metrics.corners[ BottomLeft ].stepCount ) + 1;
lineCount += qMax( metrics.corner[ TopRight ].stepCount,
metrics.corner[ BottomRight ].stepCount ) + 1;
lineCount += qMax( metrics.corners[ TopRight ].stepCount,
metrics.corners[ BottomRight ].stepCount ) + 1;
if ( metrics.centerQuad.left >= metrics.centerQuad.right )
lineCount--;
}
else
{
lineCount += 2 * ( metrics.corner[ 0 ].stepCount + 1 );
lineCount += 2 * ( metrics.corners[ 0 ].stepCount + 1 );
if ( metrics.centerQuad.left >= metrics.centerQuad.right )
lineCount--;
@ -365,7 +365,7 @@ void QskRoundedRectRenderer::renderBorderGeometry(
return;
}
const int stepCount = metrics.corner[ 0 ].stepCount;
const int stepCount = metrics.corners[ 0 ].stepCount;
const int lineCount = 4 * ( stepCount + 1 ) + 1;
const auto lines = allocateLines< Line >( geometry, lineCount );
@ -430,8 +430,8 @@ void QskRoundedRectRenderer::renderFillGeometry(
*/
const auto numPoints =
metrics.corner[0].stepCount + metrics.corner[1].stepCount
+ metrics.corner[2].stepCount + metrics.corner[3].stepCount + 4;
metrics.corners[0].stepCount + metrics.corners[1].stepCount
+ metrics.corners[2].stepCount + metrics.corners[3].stepCount + 4;
/*
points: center point + interpolated corner points
@ -454,7 +454,7 @@ void QskRoundedRectRenderer::renderFillGeometry(
{
constexpr auto id = TopLeft;
const auto& c = metrics.corner[ id ];
const auto& c = metrics.corners[ id ];
for ( ArcIterator it( c.stepCount, false ); !it.isDone(); ++it )
{
@ -467,7 +467,7 @@ void QskRoundedRectRenderer::renderFillGeometry(
}
{
constexpr auto id = BottomLeft;
const auto& c = metrics.corner[ id ];
const auto& c = metrics.corners[ id ];
for ( ArcIterator it( c.stepCount, true ); !it.isDone(); ++it )
{
@ -480,7 +480,7 @@ void QskRoundedRectRenderer::renderFillGeometry(
}
{
constexpr auto id = BottomRight;
const auto& c = metrics.corner[ id ];
const auto& c = metrics.corners[ id ];
for ( ArcIterator it( c.stepCount, false ); !it.isDone(); ++it )
{
@ -493,7 +493,7 @@ void QskRoundedRectRenderer::renderFillGeometry(
}
{
constexpr auto id = TopRight;
const auto& c = metrics.corner[ id ];
const auto& c = metrics.corners[ id ];
for ( ArcIterator it( c.stepCount, true ); !it.isDone(); ++it )
{
@ -552,7 +552,7 @@ void QskRoundedRectRenderer::renderRect( const QRectF& rect,
}
}
const int stepCount = metrics.corner[ 0 ].stepCount;
const int stepCount = metrics.corners[ 0 ].stepCount;
int borderLineCount = 0;