From 9304fd4e109c27a7dfb487a15c9a52c4055ee485 Mon Sep 17 00:00:00 2001 From: hop311 Date: Sat, 28 Oct 2023 10:40:07 +0100 Subject: Astyle formatting (with manual cleanup) --- extension/src/openvic-extension/Utilities.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'extension/src/openvic-extension/Utilities.cpp') diff --git a/extension/src/openvic-extension/Utilities.cpp b/extension/src/openvic-extension/Utilities.cpp index ea7e888..87f0422 100644 --- a/extension/src/openvic-extension/Utilities.cpp +++ b/extension/src/openvic-extension/Utilities.cpp @@ -35,7 +35,7 @@ static Ref load_dds_image(String const& path) { UtilityFunctions::print("needs_bgr_to_rgb = ", needs_bgr_to_rgb); if (needs_bgr_to_rgb) { for (size_t i = 0; i < pixels.size(); i += 4) { - std::swap(pixels[i], pixels[i+2]); + std::swap(pixels[i], pixels[i + 2]); } } @@ -60,7 +60,9 @@ static Vector2 getPolar(Vector2 UVin, Vector2 center) { Vector2 relcoord = (UVin - center); float dist = relcoord.length(); float theta = std::numbers::pi / 2 + atan2(relcoord.y, relcoord.x); - if (theta < 0.0f) theta += std::numbers::pi * 2; + if (theta < 0.0f) { + theta += std::numbers::pi * 2; + } return { dist, theta }; } @@ -84,7 +86,8 @@ static Color pie_chart_fragment(Vector2 UV, float radius, Array const& stopAngle Vector2 shadow_polar = getPolar(UV, shadow_displacement); float shadow_peak = radius + (radius - donut_inner_radius) / 2.0; - float shadow_gradient = shadow_thickness + parabola_shadow(shadow_tightness * -10.0, shadow_polar.x + shadow_peak - shadow_radius); + float shadow_gradient = shadow_thickness + parabola_shadow(shadow_tightness * -10.0, + shadow_polar.x + shadow_peak - shadow_radius); // Inner hole of the donut => make it transparent if (donut && dist <= donut_inner_radius) { @@ -133,8 +136,7 @@ void Utilities::draw_pie_chart(Ref image, for (int32_t y = 0; y < size; ++y) { for (int32_t x = 0; x < size; ++x) { image->set_pixel(x, y, pie_chart_fragment( - { static_cast(x) / static_cast(size), - static_cast(y) / static_cast(size) }, + Vector2 { static_cast(x), static_cast(y) } / size, radius, stopAngles, colours, shadow_displacement, shadow_tightness, shadow_radius, shadow_thickness, trim_colour, trim_size, gradient_falloff, gradient_base, -- cgit v1.2.3-56-ga3b1