diff options
author | hop311 <hop3114@gmail.com> | 2023-10-28 11:40:07 +0200 |
---|---|---|
committer | hop311 <hop3114@gmail.com> | 2023-11-07 23:02:34 +0100 |
commit | 9304fd4e109c27a7dfb487a15c9a52c4055ee485 (patch) | |
tree | 01e3782174afc029310b87a1eb04f834267407ea /extension/src/openvic-extension/Utilities.cpp | |
parent | d113649c115b687a30a2040161d8570907c9141b (diff) |
Astyle formatting (with manual cleanup)
Diffstat (limited to 'extension/src/openvic-extension/Utilities.cpp')
-rw-r--r-- | extension/src/openvic-extension/Utilities.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
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<Image> 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> 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<float>(x) / static_cast<float>(size), - static_cast<float>(y) / static_cast<float>(size) }, + Vector2 { static_cast<float>(x), static_cast<float>(y) } / size, radius, stopAngles, colours, shadow_displacement, shadow_tightness, shadow_radius, shadow_thickness, trim_colour, trim_size, gradient_falloff, gradient_base, |