From 1685ba6ece288e25ae1beea2c3ed999ac23a5ced Mon Sep 17 00:00:00 2001 From: "Vogel, Rick" Date: Mon, 29 Jan 2024 16:47:19 +0100 Subject: [PATCH] keep gradient direction; use const ref --- playground/gradient_fix/main.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/playground/gradient_fix/main.cpp b/playground/gradient_fix/main.cpp index 199eca8b..a82b8f5b 100644 --- a/playground/gradient_fix/main.cpp +++ b/playground/gradient_fix/main.cpp @@ -55,7 +55,7 @@ QColor extracted( const QColor& from, const QColor& to, qreal ratio ) QskGradient extracted( const QskGradient& gradient, qreal from, qreal to ) { - const auto stops = gradient.stops(); + const auto& stops = gradient.stops(); if ( stops.count() == 0 ) { @@ -108,8 +108,7 @@ QskGradient extracted( const QskGradient& gradient, qreal from, qreal to ) return extracted( stops[ toIndex.first ].color(), stops[ toIndex.second ].color(), p ); }(); - QskGradient newGradient; - newGradient.setLinearDirection( Qt::Horizontal ); + QskGradient newGradient = gradient; QskGradientStops newStops; newStops << QskGradientStop{ 0.0, fromColor };