Re: Units and resolution independence for gtk+

On Wed, 2008-08-06 at 17:07 -0400, David Zeuthen wrote:

> Also, a new type GdkUnit (and it's unsigned companion GdkUUnit) is
> introduced. It's typedef'ed to gint. Like jrb proposed some high bits
> are cannibalized to tag that the given value is an em and not a pixel
> value. Also, some users of pixel values are already using -1 and
> G_MAXINT as sentinels so bit 31 is off the table. Thus, bit 30 is used
> to specify it's an em and if so, bit 29 is used to specify the sign. A
> little convoluted but it works. Down the road one can add

I don't get why you need bit 29 here? Why can't you use bit 31 for signs
in both pixels and units? You would need to use bit 30 != bit 31 to
signify a unit instead of just having it be bit 30 == 1 be unit in order
to make negative values work right. That leaves G_MAXINT, but you could
just special case that value instead of a whole bit.

/ Alex

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