grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] grub-core/gfxmenu/widget-box.c - bugfix: incorrect drawing in cases of NULL center slice
@ 2013-07-17 17:55 Vladimir Testov
  2013-07-20 14:18 ` Andrey Borzenkov
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir Testov @ 2013-07-17 17:55 UTC (permalink / raw)
  To: grub-devel

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

See screenshots included.

If the center slice is NULL then west or north slice is also NULL so the 
height_n or width_w is also NULL. We can count these values from raw (non-
scaled) bitmaps. The values will be the same as before for common cases. And 
the bug will be fixed.

-- 
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru

[-- Attachment #2: after-widget-box.png --]
[-- Type: image/png, Size: 292 bytes --]

[-- Attachment #3: grub-widget-box-fix.patch --]
[-- Type: text/x-patch, Size: 628 bytes --]

diff -Naur grub-2.01/grub-core/gfxmenu/widget-box.c grub-box-draw/grub-core/gfxmenu/widget-box.c
--- grub-2.01/grub-core/gfxmenu/widget-box.c	2013-02-25 16:54:27.000000000 +0400
+++ grub-box-draw/grub-core/gfxmenu/widget-box.c	2013-07-17 21:25:10.536077964 +0400
@@ -81,8 +81,8 @@
   int height_n;
   int width_w;
 
-  height_n = get_height (self->scaled_pixmaps[BOX_PIXMAP_N]);
-  width_w = get_width (self->scaled_pixmaps[BOX_PIXMAP_W]);
+  height_n = get_height (self->raw_pixmaps[BOX_PIXMAP_N]);
+  width_w = get_width (self->raw_pixmaps[BOX_PIXMAP_W]);
 
   /* Draw sides.  */
   blit (self, BOX_PIXMAP_N, x + width_w, y);

[-- Attachment #4: before-widget-box.png --]
[-- Type: image/png, Size: 308 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] grub-core/gfxmenu/widget-box.c - bugfix: incorrect drawing in cases of NULL center slice
  2013-07-17 17:55 [PATCH] grub-core/gfxmenu/widget-box.c - bugfix: incorrect drawing in cases of NULL center slice Vladimir Testov
@ 2013-07-20 14:18 ` Andrey Borzenkov
  2013-07-22  7:36   ` Vladimir Testov
  0 siblings, 1 reply; 3+ messages in thread
From: Andrey Borzenkov @ 2013-07-20 14:18 UTC (permalink / raw)
  To: grub-devel

В Wed, 17 Jul 2013 21:55:58 +0400
Vladimir Testov <vladimir.testov@rosalab.ru> пишет:

> See screenshots included.
> 
> If the center slice is NULL then west or north slice is also NULL

Why? As far as I can tell code is supposed to scale all parts of
bitmap. What triggers this problem?

>                                                                    so the 
> height_n or width_w is also NULL. We can count these values from raw (non-
> scaled) bitmaps. The values will be the same as before for common cases. And 
> the bug will be fixed.
> 

This looks more like a workaround for some other problem. Also while
currently width (for W) or height (for N) does not change, it may be
reimplemented in the future. In this case this patch will create hard
to spot bug.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] grub-core/gfxmenu/widget-box.c - bugfix: incorrect drawing in cases of NULL center slice
  2013-07-20 14:18 ` Andrey Borzenkov
@ 2013-07-22  7:36   ` Vladimir Testov
  0 siblings, 0 replies; 3+ messages in thread
From: Vladimir Testov @ 2013-07-22  7:36 UTC (permalink / raw)
  To: grub-devel; +Cc: Andrey Borzenkov

On Saturday, July 20, 2013 06:18:04 PM Andrey Borzenkov wrote:
> В Wed, 17 Jul 2013 21:55:58 +0400
> 
> Vladimir Testov <vladimir.testov@rosalab.ru> пишет:
> > See screenshots included.
> > 
> > If the center slice is NULL then west or north slice is also NULL
> 
> Why? As far as I can tell code is supposed to scale all parts of
> bitmap. What triggers this problem?

Code is supposed to scale all parts of a bitmap. Yes.

It does actually. But if the bitmap's size is zero then scaled bitmap won't be 
created.

There are two arrays of bitmaps: original and scaled. Some of the scaled 
bitmaps can be non-existent. And for correct drawing of the styled box with 
some zero sizes (e.g. very short scrollbar thumb, it's west slice will have 
zero height) will be drawn incorrectly because the west SCALED bitmap wasn't 
created. The west slice is scaled horizontally. It's width should be always 
the same as the ORIGINAL west slice's width.

So if we would like to draw a styled box correctly we should take original 
west slice's width. (of height of the north slice).

> >                                                                    so the
> > 
> > height_n or width_w is also NULL. We can count these values from raw (non-
> > scaled) bitmaps. The values will be the same as before for common cases.
> > And the bug will be fixed.


> 
> This looks more like a workaround for some other problem. Also while
> currently width (for W) or height (for N) does not change, it may be
> reimplemented in the future. In this case this patch will create hard
> to spot bug.

No, this is not a workaround for some other problem.
As I understand, it's the idea of the styled box - make corner slices be 
constant and others to be correspondingly scaled. And sizes of the bitmaps 
should be correct. (e.g. widths of W, NW, SW are the same)

If this conception is about to change then themes written before won't be 
corrcectly shown. I mean loosing of backward compatibility.

I don't see how the styled box concepts are going to change... Could you 
please give an example of the concept?

I still think this patch is needed and that it's correct.

Maybe it should be modified to correspond some ideas.

And maybe the styled box algorithms should be updated. :)


Thanks for the reply!

-- 
With best regards,
_______________________________
Vladimir Testov, ROSA Laboratory.
www.rosalab.ru


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-22  7:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-17 17:55 [PATCH] grub-core/gfxmenu/widget-box.c - bugfix: incorrect drawing in cases of NULL center slice Vladimir Testov
2013-07-20 14:18 ` Andrey Borzenkov
2013-07-22  7:36   ` 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).