render gradients on borders

This commit is contained in:
Peter Hartmann 2021-12-13 16:10:53 +01:00
parent 9b10a4b523
commit 696aa8f96a
1 changed files with 17 additions and 17 deletions

View File

@ -422,28 +422,28 @@ static inline void qskCreateBorder(
const QskBoxRenderer::Quad& out, const QskBoxRenderer::Quad& in, const QskBoxRenderer::Quad& out, const QskBoxRenderer::Quad& in,
const QskBoxBorderColors& colors, Line* line ) const QskBoxBorderColors& colors, Line* line )
{ {
const Color colorLeft = colors.gradient( Qsk::Left ).startColor().rgb(); // ### const QskGradient gradientLeft = colors.gradient( Qsk::Left );
const Color colorRight = colors.gradient( Qsk::Right ).startColor().rgb(); // ### const QskGradient gradientRight = colors.gradient( Qsk::Right );
const Color colorTop = colors.gradient( Qsk::Top ).startColor().rgb(); // ### const QskGradient gradientTop = colors.gradient( Qsk::Top );
const Color colorBottom = colors.gradient( Qsk::Bottom ).startColor().rgb(); // ### const QskGradient gradientBottom = colors.gradient( Qsk::Bottom );
( line++ )->setLine( in.right, in.bottom, out.right, out.bottom, colorBottom ); ( line++ )->setLine( in.right, in.bottom, out.right, out.bottom, gradientBottom.startColor() ); // ###
( line++ )->setLine( in.left, in.bottom, out.left, out.bottom, colorBottom ); ( line++ )->setLine( in.left, in.bottom, out.left, out.bottom, gradientBottom.endColor() );
if ( colorLeft != colorBottom ) if ( gradientLeft != gradientBottom )
( line++ )->setLine( in.left, in.bottom, out.left, out.bottom, colorLeft ); ( line++ )->setLine( in.left, in.bottom, out.left, out.bottom, gradientLeft.startColor() );
( line++ )->setLine( in.left, in.top, out.left, out.top, colorLeft ); ( line++ )->setLine( in.left, in.top, out.left, out.top, gradientLeft.endColor() );
if ( colorTop != colorLeft ) if ( gradientTop != gradientLeft )
( line++ )->setLine( in.left, in.top, out.left, out.top, colorTop ); ( line++ )->setLine( in.left, in.top, out.left, out.top, gradientTop.startColor() );
( line++ )->setLine( in.right, in.top, out.right, out.top, colorTop ); ( line++ )->setLine( in.right, in.top, out.right, out.top, gradientTop.endColor() );
if ( colorRight != colorTop ) if ( gradientRight != gradientTop )
( line++ )->setLine( in.right, in.top, out.right, out.top, colorRight ); ( line++ )->setLine( in.right, in.top, out.right, out.top, gradientRight.startColor() );
( line++ )->setLine( in.right, in.bottom, out.right, out.bottom, colorRight ); ( line++ )->setLine( in.right, in.bottom, out.right, out.bottom, gradientRight.endColor() );
} }
void QskBoxRenderer::renderRectBorder( void QskBoxRenderer::renderRectBorder(
@ -461,7 +461,7 @@ void QskBoxRenderer::renderRectBorder(
return; return;
} }
const auto line = allocateLines< Line >( geometry, 4 + 1 ); const auto line = allocateLines< ColoredLine >( geometry, 4 + 1 );
qskCreateBorderMonochrome( out, in, Color(), line ); qskCreateBorderMonochrome( out, in, Color(), line );
} }
@ -587,7 +587,7 @@ void QskBoxRenderer::renderRect(
auto fillLines = line + fillLineCount; auto fillLines = line + fillLineCount;
if ( bc.isMonochrome() ) if ( bc.isMonochrome() )
qskCreateBorderMonochrome( rect, in, bc.gradient( Qsk::Left ).startColor().rgb(), fillLines ); // ### qskCreateBorderMonochrome( rect, in, bc.gradient( Qsk::Left ).startColor().rgb(), fillLines );
else else
qskCreateBorder( rect, in, bc, fillLines ); qskCreateBorder( rect, in, bc, fillLines );
} }