Commit graph

9 commits

Author SHA1 Message Date
Tobias Hunger
13d7f5e7bd Janitor: Fix typos in comments and user-facing strings
Also adapt tests for error messages containing the fixed strings.

No behavior change is intended!
2021-06-28 08:32:25 +02:00
Simon Hausmann
57bbfd531a C++: Add some docs for Brush and LinearGradientBrush 2021-06-25 20:14:53 +02:00
Olivier Goffart
44e81a40d6 Fixup C++ build 2021-03-10 17:24:31 +01:00
Simon Hausmann
50d9211e0a Fix failing default_color.60 test
Allow converting a brush to a color. In the case of a gradient, the color of the first stop is returned.

For the C++ generator this requires adding the extra case of explicitly
calling the `Brush(const Color &)` constructor, despite it being implicit,
in order to generate the correct code when we have IR that casts twice:

```
   Expression::Cast {
       from: Expression::Cast {
           from: Expression::Cast {
               from: Expression::NumberLiteral(...),
               to: Type::Color,
           }
           to: Type::Brush,
       },
       to: Type::Color,
   }
```
2021-02-04 13:44:10 +01:00
Simon Hausmann
262eb00af4 Allow an implicit conversion from a color or a linear gradient to Brush in C++ 2021-02-03 14:42:21 +01:00
Simon Hausmann
40847a5563 Expose LinearGradientBrush also in C++ 2021-02-02 08:44:53 +01:00
Simon Hausmann
9b1fd52231 Fix class vs. struct mismatch 2021-02-01 20:36:08 +01:00
Simon Hausmann
efb496fc25 Add C++ constructors for sixtyfps::Brush 2021-02-01 20:33:40 +01:00
Simon Hausmann
f33b26fa93 Make Brush compile for C++
A few changes were required:

 * `LinearGradient(LinearGradient)` as enum variant unfortunately
    won't compile because the cbindgen generated constructor
    function (`LinearGradient()`) will try to also instantiate the
    variant type inside (`LinearGradient`) and that won't find the type
    but the function itself and error out. So the inner type is now
    called `LinearGradientBrush`.

 * The same name dance was required for `Color`, where the enum variant
   instead is called `SolidColor`

 * `BrushInner` was removed in favor of just `Brush`. The nicer Rust
    API will be the public variant, and for cbindgen we can just put
    the generated enum into an internal namespace, like we do for
    Resource for example

 * A `NoBrush` variant was added. Maybe that name could be improved?
2021-02-01 16:51:04 +01:00