diff --git a/ashura/engine/canvas.cc b/ashura/engine/canvas.cc index ffd31913..c2119cfb 100644 --- a/ashura/engine/canvas.cc +++ b/ashura/engine/canvas.cc @@ -76,20 +76,20 @@ void path::rrect(Vec &vtx, Vec4 radii, u32 segments) } radii = radii * 2; - radii.x = min(radii.x, 2.0f); - radii.y = min(radii.y, 2.0f); - radii.z = min(radii.z, 2.0f); - radii.w = min(radii.w, 2.0f); + radii.x = min(radii.x, 2.0F); + radii.y = min(radii.y, 2.0F); + radii.z = min(radii.z, 2.0F); + radii.w = min(radii.w, 2.0F); /// clipping - radii.y = min(radii.y, 2.0f - radii.x); - f32 max_radius_z = min(2.0f - radii.x, 1.0f - radii.y); + radii.y = min(radii.y, 2.0F - radii.x); + f32 max_radius_z = min(2.0F - radii.x, 1.0F - radii.y); radii.z = min(radii.z, max_radius_z); - f32 max_radius_w = min(max_radius_z, 1.0f - radii.z); + f32 max_radius_w = min(max_radius_z, 1.0F - radii.z); radii.w = min(radii.w, max_radius_w); u32 const curve_segments = (segments - 8) / 4; - f32 const step = (curve_segments == 0) ? 0.0f : ((PI / 2) / curve_segments); + f32 const step = (curve_segments == 0) ? 0.0F : ((PI / 2) / curve_segments); u32 const first = vtx.size32(); vtx.extend_uninit(segments).unwrap(); @@ -129,7 +129,7 @@ void path::rrect(Vec &vtx, Vec4 radii, u32 segments) for (u32 s = 0; s < curve_segments; s++) { vtx[first + i++] = Vec2{1 - radii.y, (-1 + radii.y)} + - radii.y * rotor(PI * 3.0f / 2.0f + s * step); + radii.y * rotor(PI * 3.0F / 2.0F + s * step); } vtx[first + i++] = Vec2{1, -1 + radii.y}; @@ -137,16 +137,16 @@ void path::rrect(Vec &vtx, Vec4 radii, u32 segments) void path::brect(Vec &vtx, Vec4 slant) { - slant = slant * 2.0f; - slant.x = min(slant.x, 2.0f); - slant.y = min(slant.y, 2.0f); - slant.z = min(slant.z, 2.0f); - slant.w = min(slant.w, 2.0f); + slant = slant * 2.0F; + slant.x = min(slant.x, 2.0F); + slant.y = min(slant.y, 2.0F); + slant.z = min(slant.z, 2.0F); + slant.w = min(slant.w, 2.0F); - slant.y = min(slant.y, 2.0f - slant.x); - f32 max_radius_z = min(2.0f - slant.x, 2.0f - slant.y); + slant.y = min(slant.y, 2.0F - slant.x); + f32 max_radius_z = min(2.0F - slant.x, 2.0F - slant.y); slant.z = min(slant.z, max_radius_z); - f32 max_radius_w = min(max_radius_z, 2.0f - slant.z); + f32 max_radius_w = min(max_radius_z, 2.0F - slant.z); slant.w = min(slant.w, max_radius_w); Vec2 const vertices[] = {{-1 + slant.x, -1}, {1 - slant.y, -1}, @@ -168,7 +168,7 @@ void path::bezier(Vec &vtx, Vec2 cp0, Vec2 cp1, Vec2 cp2, u32 segments) vtx.extend_uninit(segments).unwrap(); - f32 const step = 1.0f / (segments - 1); + f32 const step = 1.0F / (segments - 1); for (u32 i = 0; i < segments; i++) { @@ -189,7 +189,7 @@ void path::cubic_bezier(Vec &vtx, Vec2 cp0, Vec2 cp1, Vec2 cp2, Vec2 cp3, vtx.extend_uninit(segments).unwrap(); - f32 const step = 1.0f / (segments - 1); + f32 const step = 1.0F / (segments - 1); for (u32 i = 0; i < segments; i++) { @@ -211,7 +211,7 @@ void path::catmull_rom(Vec &vtx, Vec2 cp0, Vec2 cp1, Vec2 cp2, Vec2 cp3, vtx.extend_uninit(segments).unwrap(); - f32 const step = 1.0f / (segments - 1); + f32 const step = 1.0F / (segments - 1); for (u32 i = 0; i < segments; i++) { diff --git a/ashura/engine/canvas.h b/ashura/engine/canvas.h index 9d348382..8491eeed 100644 --- a/ashura/engine/canvas.h +++ b/ashura/engine/canvas.h @@ -112,9 +112,9 @@ struct ShapeInfo Vec4 corner_radii = {0, 0, 0, 0}; - f32 stroke = 0.0f; + f32 stroke = 0.0F; - f32 thickness = 1.0f; + f32 thickness = 1.0F; ColorGradient tint = {}; diff --git a/ashura/engine/text.cc b/ashura/engine/text.cc index 6fa83bcc..09dfbb08 100644 --- a/ashura/engine/text.cc +++ b/ashura/engine/text.cc @@ -227,7 +227,7 @@ static inline void insert_run(TextLayout &l, FontStyle const &s, u32 first, .num_codepoints = count, .style = style, .font_height = s.font_height, - .line_height = max(s.line_height, 1.0f), + .line_height = max(s.line_height, 1.0F), .first_glyph = first_glyph, .num_glyphs = num_glyphs, .metrics = TextRunMetrics{.advance = advance, diff --git a/ashura/engine/text.h b/ashura/engine/text.h index 3e854933..b38e6720 100644 --- a/ashura/engine/text.h +++ b/ashura/engine/text.h @@ -234,7 +234,7 @@ struct FontStyle { Font *font = nullptr; f32 font_height = 20; - f32 line_height = 1.2f; + f32 line_height = 1.2F; }; /// @param shadow_scale relative. multiplied by font_height diff --git a/ashura/engine/views.h b/ashura/engine/views.h index f8cbf036..e828ce7b 100644 --- a/ashura/engine/views.h +++ b/ashura/engine/views.h @@ -1325,7 +1325,7 @@ struct CheckBox : View .stroke = 0, .thickness = styling.tick_thickness, .tint = styling.tick_color}, - span({{0.125f, 0.5f}, {0.374f, 0.75f}, {0.775f, 0.25f}})); + span({{0.125F, 0.5F}, {0.374F, 0.75F}, {0.775F, 0.25F}})); } if (state.press.focus.focused) @@ -2347,7 +2347,7 @@ struct ScrollBar : View state.t = clamp((ctx.mouse.position[main_axis] - region.extent[main_axis] / 2) / region.extent[main_axis], - 0.0f, 1.0f); + 0.0F, 1.0F); cb.scrolled(state.t); } diff --git a/ashura/std/tests/option.cc b/ashura/std/tests/option.cc index 3dfe0fe8..9ddcafe3 100644 --- a/ashura/std/tests/option.cc +++ b/ashura/std/tests/option.cc @@ -436,22 +436,22 @@ TEST(OptionLifetimeTest, MapOrElse) TEST(OptionTest, AndThen) { auto &&a = Option(Some(90)).and_then( - [](int &x) { return Option(Some(static_cast(x) + 90.0f)); }); + [](int &x) { return Option(Some(static_cast(x) + 90.0F)); }); - EXPECT_FLOAT_EQ(std::move(a).unwrap(), 180.0f); + EXPECT_FLOAT_EQ(std::move(a).unwrap(), 180.0F); auto &&b = make_none().and_then( - [](int &x) { return Option(Some(static_cast(x) + 90.0f)); }); + [](int &x) { return Option(Some(static_cast(x) + 90.0F)); }); EXPECT_EQ(b, None); } TEST(OptionTest, OrElse) { - auto &&a = Option(Some(90.0f)).or_else([]() { return Option(Some(0.5f)); }); - EXPECT_FLOAT_EQ(std::move(a).unwrap(), 90.0f); + auto &&a = Option(Some(90.0F)).or_else([]() { return Option(Some(0.5F)); }); + EXPECT_FLOAT_EQ(std::move(a).unwrap(), 90.0F); - auto &&b = Option(None).or_else([]() { return Option(Some(0.5f)); }); - EXPECT_FLOAT_EQ(std::move(b).unwrap(), 0.5f); + auto &&b = Option(None).or_else([]() { return Option(Some(0.5F)); }); + EXPECT_FLOAT_EQ(std::move(b).unwrap(), 0.5F); auto &&c = Option(None).or_else([]() { return Option(None); }); EXPECT_EQ(c, None); diff --git a/ashura/std/tests/result.cc b/ashura/std/tests/result.cc index 534d2ea2..a42b23b4 100644 --- a/ashura/std/tests/result.cc +++ b/ashura/std/tests/result.cc @@ -166,8 +166,8 @@ TEST(ResultTest, MapOrElse) TEST(ResultTest, AndThen) { - auto a = [](int v) -> Result { return Ok{v * 2.0f}; }; - EXPECT_FLOAT_EQ((make_ok(20).and_then(a).unwrap()), 40.0f); + auto a = [](int v) -> Result { return Ok{v * 2.0F}; }; + EXPECT_FLOAT_EQ((make_ok(20).and_then(a).unwrap()), 40.0F); EXPECT_TRUE((make_err(-20).and_then(a).is_err())); @@ -179,7 +179,7 @@ TEST(ResultTest, AndThen) return Ok{res}; }; - EXPECT_EQ((make_ok(80).and_then(b).unwrap()), (std::vector{80.0f})); + EXPECT_EQ((make_ok(80).and_then(b).unwrap()), (std::vector{80.0F})); EXPECT_TRUE((make_err(-20).and_then(b).is_err())); EXPECT_EQ((make_err(-20).and_then(b).unwrap_err()), -20);