From 999b5416000319a66d794e5066f3ca61de7c0ece Mon Sep 17 00:00:00 2001 From: Projectitis Date: Mon, 28 Feb 2022 20:54:48 +1300 Subject: [PATCH] Replace VLA --- src/shapes/paint/linear_gradient.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/shapes/paint/linear_gradient.cpp b/src/shapes/paint/linear_gradient.cpp index 4b0ef361..4df93f2a 100644 --- a/src/shapes/paint/linear_gradient.cpp +++ b/src/shapes/paint/linear_gradient.cpp @@ -82,14 +82,17 @@ void LinearGradient::update(ComponentDirt value) { const double ro = opacity() * renderOpacity(); const auto count = m_Stops.size(); // TODO: replace these with stack-alloc helpers? - ColorInt colors[count]; - float stops[count]; + ColorInt* colors = new ColorInt[count]; + float* stops = new float[count]; for (size_t i = 0; i < count; ++i) { colors[i] = colorModulateOpacity(m_Stops[i]->colorValue(), ro); stops[i] = m_Stops[i]->position(); } makeGradient(start, end, colors, stops, count); + + delete[] stops; + delete[] colors; } }