[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems with gnustep-drawn window decorations and gui elements.

From: Fred Kiefer
Subject: Re: problems with gnustep-drawn window decorations and gui elements.
Date: Thu, 02 Jun 2011 21:29:46 +0200
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; de; rv: Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10

On 31.05.2011 22:00, Eric Wasylishen wrote:
I looked in to this a bit. The basic problem is drawing a 9x9 image
in a even-sized button (14x14 I think?). The commit that probably
caused it was my r33002 where I added rounding to -[NSButtonCell.m
drawImage:withFrame:inView:] Previous to that we were depending on
the backend to pixel align the image location.

Unfortunately it's not as simple as just using floor() instead of
round() in [NSButtonCell.m drawImage:withFrame:inView:]...

I attached a screenshot of a test I did with a pair of 16x16 buttons,
the one on the left with a 9x9 image and the one on the right with a
8x8 image. To me both os the OS X buttons "look" like their image is
centred, but the 9x9 image one on GS looks like the image is too far
to the right (same problem as with the scroller arrows.)

From the looks of it, cocoa is treating the button as having a 1pt
border on the top and left sides, and a 2pt border on the bottom and
right sides. This seems to make images 'feel' like they centre
better. GS on the other hand treats the border as 2 pt all around.
So, we could try copying cocoa's behaviour, which would involve
modifying the api of the GSTheme method for getting button borders to
return a separate left, top, right, and bottom dimension (which I
think we should do anyway.) Thoughts?

Great that you are looking into this.

One possible reason for this problem is the code change I made a few
days ago, replacing floor with rintf. This may result in a slightly
different rounding behaviour. The reason I made this change was that
some this functions may not present on specific systems and for rintf we
already have a configuration time detection (plus a default) in place.

But I don't think this cause the issue. More likely it goes back to a
long standing problem. GNUstep per default draws a button border rather
similar to what Apple does, two pixels at the bottom and right and one pixel at the top and left. What doesn't fit here is that the theme has to report back the size of the border as an NSSize. I think we report back the size as (3, 3) and have already an offset of one pixel here. And for some reason this gets preserved in all the following computation.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]