All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vladimir Testov <vladimir.testov@rosalab.ru>
To: grub-devel@gnu.org
Subject: [4/4] [PATCH] incorrect calculation of radius in circular_progress.
Date: Wed, 13 Mar 2013 14:53:10 +0400	[thread overview]
Message-ID: <8469205.Z2B8CHPVqt@icedphoenix> (raw)


[-- 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 --]

             reply	other threads:[~2013-03-13 10:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-13 10:53 Vladimir Testov [this message]
2013-03-19  6:55 ` [4/4] [PATCH] incorrect calculation of radius in circular_progress Vladimir 'φ-coder/phcoder' Serbinenko
  -- strict thread matches above, loose matches on Subject: below --
2013-03-20  7:43 Vladimir Testov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8469205.Z2B8CHPVqt@icedphoenix \
    --to=vladimir.testov@rosalab.ru \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.