Skip to contentSkip to conversation

incorrect calculation of radius in circular_progress.

PATCH Vladimir Testov 1 participant 1 message Mar 20, 2013

lore
Share & tools
lore
#0 lore raw

fixed.

variables changed to outer_diameter and inner_diameter

It is more human-readable also

Signature · 4 lines
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
grub-core/gfxmenu/gui_circular_progress.c +9 -1
diff -Naur grub-2.00/grub-core/gfxmenu/gui_circular_progress.c grub-new2/grub-core/gfxmenu/gui_circular_progress.c
@@ -138,7 +138,15 @@
                           (height - center_height) / 2, 0, 0,
                           center_width, center_height);
 
-  int radius = width / 2 - tick_width / 2 - 1;
+  int outer_diameter = width;
+  if (height < outer_diameter) {
+    outer_diameter = height;
+  }
+  int inner_diameter = tick_width;
+  if (tick_height > inner_diameter) {
+    inner_diameter = tick_height;
+  }
+  int radius = outer_diameter / 2 - inner_diameter / 2 - 1;
   int nticks;
   int tick_begin;
   int tick_end;