mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-01 14:21:16 +00:00
Make floating point operations compile with no_std
Use num_traits and libm instead, also for euclid.
This commit is contained in:
parent
e8302452b5
commit
bf84bb2ab6
5 changed files with 15 additions and 0 deletions
|
@ -27,6 +27,8 @@ default = ["std"]
|
||||||
# from a single core, and not in a interrupt or signal handler.
|
# from a single core, and not in a interrupt or signal handler.
|
||||||
unsafe_single_core = []
|
unsafe_single_core = []
|
||||||
|
|
||||||
|
libm = ["num-traits/libm", "euclid/libm"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
const-field-offset = { version = "0.1", path = "../../helper_crates/const-field-offset" }
|
const-field-offset = { version = "0.1", path = "../../helper_crates/const-field-offset" }
|
||||||
vtable = { version="0.1.1", path = "../../helper_crates/vtable" }
|
vtable = { version="0.1.1", path = "../../helper_crates/vtable" }
|
||||||
|
@ -52,6 +54,7 @@ unicode-segmentation = "1.8.0"
|
||||||
rgb = "0.8.27"
|
rgb = "0.8.27"
|
||||||
pin-project = "1"
|
pin-project = "1"
|
||||||
atomic-polyfill = { version = "0.1.5" }
|
atomic-polyfill = { version = "0.1.5" }
|
||||||
|
num-traits = { version = "0.2", default-features = false }
|
||||||
|
|
||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
instant = { version = "0.1", features = [ "wasm-bindgen", "now" ] }
|
instant = { version = "0.1", features = [ "wasm-bindgen", "now" ] }
|
||||||
|
|
|
@ -15,6 +15,9 @@ use super::{Color, Point};
|
||||||
use crate::properties::InterpolatedPropertyValue;
|
use crate::properties::InterpolatedPropertyValue;
|
||||||
use crate::SharedVector;
|
use crate::SharedVector;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
use num_traits::float::Float;
|
||||||
|
|
||||||
/// A brush is a data structure that is used to describe how
|
/// A brush is a data structure that is used to describe how
|
||||||
/// a shape, such as a rectangle, path or even text, shall be filled.
|
/// a shape, such as a rectangle, path or even text, shall be filled.
|
||||||
/// A brush can also be applied to the outline of a shape, that means
|
/// A brush can also be applied to the outline of a shape, that means
|
||||||
|
|
|
@ -13,6 +13,9 @@ This module contains color related types for the run-time library.
|
||||||
|
|
||||||
use crate::properties::InterpolatedPropertyValue;
|
use crate::properties::InterpolatedPropertyValue;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
use num_traits::float::Float;
|
||||||
|
|
||||||
/// RgbaColor stores the red, green, blue and alpha components of a color
|
/// RgbaColor stores the red, green, blue and alpha components of a color
|
||||||
/// with the precision of the generic parameter T. For example if T is f32,
|
/// with the precision of the generic parameter T. For example if T is f32,
|
||||||
/// the values are normalized between 0 and 1. If T is u8, they values range
|
/// the values are normalized between 0 and 1. If T is u8, they values range
|
||||||
|
|
|
@ -32,6 +32,9 @@ use const_field_offset::FieldOffsets;
|
||||||
use core::pin::Pin;
|
use core::pin::Pin;
|
||||||
use sixtyfps_corelib_macros::*;
|
use sixtyfps_corelib_macros::*;
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
use num_traits::float::Float;
|
||||||
|
|
||||||
#[derive(Copy, Clone, Debug, PartialEq, strum::EnumString, strum::Display)]
|
#[derive(Copy, Clone, Debug, PartialEq, strum::EnumString, strum::Display)]
|
||||||
#[repr(C)]
|
#[repr(C)]
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
|
|
|
@ -27,6 +27,9 @@ use once_cell::unsync::OnceCell;
|
||||||
use pin_project::pin_project;
|
use pin_project::pin_project;
|
||||||
use pin_weak::rc::{PinWeak, Rc};
|
use pin_weak::rc::{PinWeak, Rc};
|
||||||
|
|
||||||
|
#[cfg(not(feature = "std"))]
|
||||||
|
use num_traits::float::Float;
|
||||||
|
|
||||||
type DependencyListHead =
|
type DependencyListHead =
|
||||||
crate::properties::dependency_tracker::DependencyListHead<*const dyn ErasedRepeater>;
|
crate::properties::dependency_tracker::DependencyListHead<*const dyn ErasedRepeater>;
|
||||||
type ComponentRc<C> = vtable::VRc<crate::component::ComponentVTable, C>;
|
type ComponentRc<C> = vtable::VRc<crate::component::ComponentVTable, C>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue