* [4/4] [PATCH] incorrect calculation of radius in circular_progress.
@ 2013-03-13 10:53 Vladimir Testov
2013-03-19 6:55 ` Vladimir 'φ-coder/phcoder' Serbinenko
0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Testov @ 2013-03-13 10:53 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1.1: Type: text/plain, Size: 1464 bytes --]
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.
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #1.2: Type: text/html, Size: 12377 bytes --]
[-- Attachment #2: grub-2.00-radius-correction.patch --]
[-- Type: text/x-patch, Size: 729 bytes --]
diff -Naur grub-new3/grub-core/gfxmenu/gui_circular_progress.c grub-new4/grub-core/gfxmenu/gui_circular_progress.c
--- grub-new3/grub-core/gfxmenu/gui_circular_progress.c 2013-03-11 16:01:08.585385148 +0400
+++ grub-new4/grub-core/gfxmenu/gui_circular_progress.c 2013-03-11 16:39:36.781832463 +0400
@@ -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;
[-- Attachment #3: grub-tick-height.png --]
[-- Type: image/png, Size: 26792 bytes --]
[-- Attachment #4: grub-tick-width.png --]
[-- Type: image/png, Size: 26745 bytes --]
[-- Attachment #5: grub-tick-rect-height.png --]
[-- Type: image/png, Size: 26485 bytes --]
[-- Attachment #6: grub-tick-rect-width.png --]
[-- Type: image/png, Size: 25802 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [4/4] [PATCH] incorrect calculation of radius in circular_progress.
@ 2013-03-20 7:43 Vladimir Testov
0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Testov @ 2013-03-20 7:43 UTC (permalink / raw)
To: grub-devel
[-- Attachment #1: Type: text/plain, Size: 199 bytes --]
fixed.
variables changed to outer_diameter and inner_diameter
It is more human-readable also
--
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru
[-- Attachment #2: grub-2.00-radius-correction.patch --]
[-- Type: text/x-patch, Size: 817 bytes --]
diff -Naur grub-2.00/grub-core/gfxmenu/gui_circular_progress.c grub-new2/grub-core/gfxmenu/gui_circular_progress.c
--- grub-2.00/grub-core/gfxmenu/gui_circular_progress.c 2010-12-01 17:45:43.000000000 +0300
+++ grub-new2/grub-core/gfxmenu/gui_circular_progress.c 2013-03-20 09:03:03.293238118 +0400
@@ -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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-03-20 7:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-13 10:53 [4/4] [PATCH] incorrect calculation of radius in circular_progress Vladimir Testov
2013-03-19 6:55 ` Vladimir 'φ-coder/phcoder' Serbinenko
-- strict thread matches above, loose matches on Subject: below --
2013-03-20 7:43 Vladimir Testov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).