internal API simplyfied
This commit is contained in:
parent
615e0016c2
commit
18b0594cd6
@ -27,8 +27,10 @@ namespace QskVertex
|
|||||||
class ColorMapSolid
|
class ColorMapSolid
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
constexpr inline ColorMapSolid( Color color )
|
constexpr inline ColorMapSolid() = default;
|
||||||
: m_color( color )
|
|
||||||
|
inline ColorMapSolid( const QskGradient& gradient )
|
||||||
|
: m_color( gradient.rgbStart() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,9 +46,9 @@ namespace QskVertex
|
|||||||
class ColorMapGradient
|
class ColorMapGradient
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
inline ColorMapGradient( Color color1, Color color2 )
|
inline ColorMapGradient( const QskGradient& gradient )
|
||||||
: m_color1( color1 )
|
: m_color1( gradient.rgbStart() )
|
||||||
, m_color2( color2 )
|
, m_color2( gradient.rgbEnd() )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1033,16 +1033,18 @@ static inline void qskRenderFillRandom(
|
|||||||
const QskBoxRenderer::Metrics& metrics,
|
const QskBoxRenderer::Metrics& metrics,
|
||||||
const QskGradient& gradient, ColoredLine* line )
|
const QskGradient& gradient, ColoredLine* line )
|
||||||
{
|
{
|
||||||
|
// here we know that: gradient.stepCount() <= 1 !
|
||||||
|
|
||||||
const auto orientation = qskQtOrientation( gradient );
|
const auto orientation = qskQtOrientation( gradient );
|
||||||
|
|
||||||
if ( gradient.isMonochrome() )
|
if ( gradient.isMonochrome() )
|
||||||
{
|
{
|
||||||
const ColorMapSolid map( gradient.rgbStart() );
|
const ColorMapSolid map( gradient );
|
||||||
qskRenderFillLines( metrics, orientation, line, map );
|
qskRenderFillLines( metrics, orientation, line, map );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const ColorMapGradient map( gradient.rgbStart(), gradient.rgbEnd() );
|
const ColorMapGradient map( gradient );
|
||||||
qskRenderFillLines( metrics, orientation, line, map );
|
qskRenderFillLines( metrics, orientation, line, map );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1051,6 +1053,8 @@ static inline void qskRenderBoxRandom(
|
|||||||
const QskBoxRenderer::Metrics& metrics, const QskBoxBorderColors& borderColors,
|
const QskBoxRenderer::Metrics& metrics, const QskBoxBorderColors& borderColors,
|
||||||
const QskGradient& gradient, ColoredLine* fillLine, ColoredLine* borderLine )
|
const QskGradient& gradient, ColoredLine* fillLine, ColoredLine* borderLine )
|
||||||
{
|
{
|
||||||
|
// here we know that: gradient.stepCount() <= 1 !
|
||||||
|
|
||||||
const auto& bc = borderColors;
|
const auto& bc = borderColors;
|
||||||
|
|
||||||
if ( bc.isMonochrome() )
|
if ( bc.isMonochrome() )
|
||||||
@ -1059,14 +1063,14 @@ static inline void qskRenderBoxRandom(
|
|||||||
|
|
||||||
if ( gradient.isMonochrome() )
|
if ( gradient.isMonochrome() )
|
||||||
{
|
{
|
||||||
const ColorMapSolid fillMap( gradient.rgbStart() );
|
const ColorMapSolid fillMap( gradient );
|
||||||
qskRenderLines( metrics, Qt::Vertical, borderLine, borderMap, fillLine, fillMap );
|
qskRenderLines( metrics, Qt::Vertical, borderLine, borderMap, fillLine, fillMap );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto orientation = qskQtOrientation( gradient );
|
const auto orientation = qskQtOrientation( gradient );
|
||||||
|
|
||||||
const ColorMapGradient fillMap( gradient.rgbStart(), gradient.rgbEnd() );
|
const ColorMapGradient fillMap( gradient );
|
||||||
qskRenderLines( metrics, orientation, borderLine, borderMap, fillLine, fillMap );
|
qskRenderLines( metrics, orientation, borderLine, borderMap, fillLine, fillMap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1086,14 +1090,14 @@ static inline void qskRenderBoxRandom(
|
|||||||
|
|
||||||
if ( gradient.isMonochrome() )
|
if ( gradient.isMonochrome() )
|
||||||
{
|
{
|
||||||
const ColorMapSolid fillMap( gradient.rgbStart() );
|
const ColorMapSolid fillMap( gradient );
|
||||||
qskRenderLines( metrics, Qt::Vertical, borderLine, tl, tr, bl, br, fillLine, fillMap );
|
qskRenderLines( metrics, Qt::Vertical, borderLine, tl, tr, bl, br, fillLine, fillMap );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
const auto orientation = qskQtOrientation( gradient );
|
const auto orientation = qskQtOrientation( gradient );
|
||||||
|
|
||||||
const ColorMapGradient fillMap( gradient.rgbStart(), gradient.rgbEnd() );
|
const ColorMapGradient fillMap( gradient );
|
||||||
qskRenderLines( metrics, orientation, borderLine, tl, tr, bl, br, fillLine, fillMap );
|
qskRenderLines( metrics, orientation, borderLine, tl, tr, bl, br, fillLine, fillMap );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -550,7 +550,7 @@ void QskBoxRenderer::renderRectFill(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const auto line = allocateLines< Line >( geometry, 2 );
|
const auto line = allocateLines< Line >( geometry, 2 );
|
||||||
qskCreateFillRandom( Qt::Vertical, in, ColorMapSolid( Color() ), line );
|
qskCreateFillRandom( Qt::Vertical, in, ColorMapSolid(), line );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QskBoxRenderer::renderRect(
|
void QskBoxRenderer::renderRect(
|
||||||
@ -618,16 +618,14 @@ void QskBoxRenderer::renderRect(
|
|||||||
|
|
||||||
if ( fillLineCount > 0 )
|
if ( fillLineCount > 0 )
|
||||||
{
|
{
|
||||||
const auto& gd = gradient;
|
if ( gradient.isMonochrome() )
|
||||||
|
|
||||||
if ( gd.isMonochrome() )
|
|
||||||
{
|
{
|
||||||
const ColorMapSolid colorMap( gd.rgbStart() );
|
const ColorMapSolid colorMap( gradient );
|
||||||
qskCreateFillRandom( Qt::Vertical, in, colorMap, line );
|
qskCreateFillRandom( Qt::Vertical, in, colorMap, line );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bool fillRandom = gd.stepCount() <= 1;
|
bool fillRandom = gradient.stepCount() <= 1;
|
||||||
if ( fillRandom )
|
if ( fillRandom )
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -635,20 +633,20 @@ void QskBoxRenderer::renderRect(
|
|||||||
but we didn't implement a random fill algo for
|
but we didn't implement a random fill algo for
|
||||||
diagonal gradients yet.
|
diagonal gradients yet.
|
||||||
*/
|
*/
|
||||||
fillRandom = !gd.linearDirection().isTilted();
|
fillRandom = !gradient.linearDirection().isTilted();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fillRandom )
|
if ( fillRandom )
|
||||||
{
|
{
|
||||||
const auto orientation = gd.linearDirection().isVertical()
|
const auto orientation = gradient.linearDirection().isVertical()
|
||||||
? Qt::Vertical : Qt::Horizontal;
|
? Qt::Vertical : Qt::Horizontal;
|
||||||
|
|
||||||
const ColorMapGradient colorMap( gd.rgbStart(), gd.rgbEnd() );
|
const ColorMapGradient colorMap( gradient );
|
||||||
qskCreateFillRandom( orientation, in, colorMap, line );
|
qskCreateFillRandom( orientation, in, colorMap, line );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
qskCreateFillOrdered( in, gd, line );
|
qskCreateFillOrdered( in, gradient, line );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user