Fix compilation of @linear-gradient with brush properties in C++

This commit is contained in:
Simon Hausmann 2021-02-03 13:22:44 +01:00
parent 3854d1236a
commit 1d54947de9
2 changed files with 17 additions and 1 deletions

View file

@ -1661,7 +1661,7 @@ fn compile_expression(
format!("sixtyfps::GradientStop{{ {}, {}, }}", color, position)
});
format!(
"[&] {{ const sixtyfps::GradientStop stops[] = {{ {} }}; return sixtyfps::LinearGradientBrush({}, stops, {}); }}()",
"[&] {{ const sixtyfps::GradientStop stops[] = {{ {} }}; return sixtyfps::Brush(sixtyfps::LinearGradientBrush({}, stops, {})); }}()",
stops_it.join(", "), angle, stops.len()
)
}

View file

@ -0,0 +1,16 @@
/* LICENSE BEGIN
This file is part of the SixtyFPS Project -- https://sixtyfps.io
Copyright (c) 2020 Olivier Goffart <olivier.goffart@sixtyfps.io>
Copyright (c) 2020 Simon Hausmann <simon.hausmann@sixtyfps.io>
SPDX-License-Identifier: GPL-3.0-only
This file is also available under commercial licensing terms.
Please contact info@sixtyfps.io for more information.
LICENSE END */
// Verify that this compiles with all generators
Test := Rectangle {
background: @linear-gradient(45deg, #ff9a9e 0%, #fad0c4 99%, #fad0c4 100%);
}