incorrect calculation of radius in circular_progress.
PATCH 4/4 incorrect calculation of radius in circular_progress.
In current state, radius (R) is:
R = width / 2 - tick_width / 2 - 1
where:
width is circular_progress's width
tick_width is tick_bitmap's width
Everything goes O.K. until we have height not equal to width or tick_height not equal to tick_width. Height and tick_height have no effect on radius.
where:
height is circular_progress's height
tick_height is tick_bitmap's height
Patch fixes the strategy to count the radius.
after applying this patch we won't see 2 problems described in later part of this letter.
See files included.
example: (what was before)
center.png is 50x50 image
tick.png is 3x3 image
tick_width.png is 9x3 image
tick_height.png 3x9 image
grub-tick-height.png
width = 50
height = 50
center_image = "center.png"
tick_bitmap = "tick_height.png"
Problem1: As we can see, ticks are misplaced and some of them are incomplete.
grub-tick-width.png
width = 50
height = 50
center_image = "center.png"
tick_bitmap = "tick_width.png"
Everything is O.K.
grub-tick-rect-height.png
width = 50
height = 150
center_image = "center.png"
tick_bitmap = "tick.png"
Everything is O.K.
grub-tick-rect-width.png
width = 150
height = 50
center_image = "center.png"
tick_bitmap = "tick.png"
Problem2: We can see only two ticks - other ticks are not printed.
Signature · 4 lines
With best regards, _______________________________ Vladimir Testov, ROSA Laboratory. www.rosalab.ru
grub-core/gfxmenu/gui_circular_progress.c +9 -1
@@ -138,7 +138,15 @@ (height - center_height) /2 ,0 ,0 , center_width, center_height); -int radius = width /2 - tick_width /2 -1 ; +int min = width; +if (height < min) { + min = height; + } +int max = tick_width; +if (tick_height > max) { + max = tick_height; + } +int radius = min /2 - max /2 -1 ;int nticks;int tick_begin;int tick_end;
grub-core/gfxmenu/gui_circular_progress.c line 144
Quoted 4 lines · Vladimir Testov
grub-core/gfxmenu/gui_circular_progress.c +4
-0+int min = width; +if (height < min) { + min = height; + }
Please avoid using variables like max/min which can easily conflict with macros defined on some systems