From bad4f90a169d1ec36aa8ca203fcf56085a3a6440 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 25 Oct 2022 18:19:32 +0200 Subject: [PATCH] if/else cascade reordered --- src/nodes/QskBoxRendererEllipse.cpp | 46 ++++++++++++++--------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/nodes/QskBoxRendererEllipse.cpp b/src/nodes/QskBoxRendererEllipse.cpp index 168abfd1..111ad90a 100644 --- a/src/nodes/QskBoxRendererEllipse.cpp +++ b/src/nodes/QskBoxRendererEllipse.cpp @@ -883,7 +883,29 @@ static inline int qskFillLineCount( int lineCount = 0; - if ( gradient.isTilted() ) + if ( gradient.isVertical() ) + { + lineCount += qMax( metrics.corner[ TopLeft ].stepCount, + metrics.corner[ TopRight ].stepCount ) + 1; + + lineCount += qMax( metrics.corner[ BottomLeft ].stepCount, + metrics.corner[ BottomRight ].stepCount ) + 1; + + if ( metrics.centerQuad.top >= metrics.centerQuad.bottom ) + lineCount--; + } + else if ( gradient.isHorizontal() ) + { + lineCount += qMax( metrics.corner[ TopLeft ].stepCount, + metrics.corner[ BottomLeft ].stepCount ) + 1; + + lineCount += qMax( metrics.corner[ TopRight ].stepCount, + metrics.corner[ BottomRight ].stepCount ) + 1; + + if ( metrics.centerQuad.left >= metrics.centerQuad.right ) + lineCount--; + } + else { lineCount += 2 * ( stepCount + 1 ); @@ -912,28 +934,6 @@ static inline int qskFillLineCount( lineCount++; // happens in a corner case - needs to be understood: TODO #endif } - else if ( gradient.isVertical() ) - { - lineCount += qMax( metrics.corner[ TopLeft ].stepCount, - metrics.corner[ TopRight ].stepCount ) + 1; - - lineCount += qMax( metrics.corner[ BottomLeft ].stepCount, - metrics.corner[ BottomRight ].stepCount ) + 1; - - if ( metrics.centerQuad.top >= metrics.centerQuad.bottom ) - lineCount--; - } - else if ( gradient.isHorizontal() ) - { - lineCount += qMax( metrics.corner[ TopLeft ].stepCount, - metrics.corner[ BottomLeft ].stepCount ) + 1; - - lineCount += qMax( metrics.corner[ TopRight ].stepCount, - metrics.corner[ BottomRight ].stepCount ) + 1; - - if ( metrics.centerQuad.left >= metrics.centerQuad.right ) - lineCount--; - } // adding vertexes for the stops - beside the first/last