Am Samstag, 25. November 2006 13:45 schrieb Michael Gerz:
> Georg Baum wrote:
> 
> >No, it does not fix a conversion, it suppresses a compiler warning. I 
don't 
> >understand why x_ is of type double at all. Why not int?
> >  
> >
> I guess there are cases (like with multiple hfills), where x_ would be 
> incremented by a fraction of a pixel. If this happens several times and 
> we always strip the fraction, we get slightly incorrect output.

That would be the only reason that would make sense I could think of, but 
how can that happen? The screen is pixel based, the metrics are calculated 
in pixel units, so where do we get double numbers? In theory all 
calculations could be done in whole pixels. I don't dare to simply change 
this, because several variables are involved, and I can't imagine that 
somebody used double instead of int without reason.

Even if you consider the multiple hfill case, e.g. you have to draw 3 
hfills in a space of 37 pixels you somehow have to distribute this space to 
the 3 hfills, e.g. the first and second one are 12 pixels wide, and the 
third is 13 pixels wide. No need to use fractions of pixels here. OK, they 
might make sense for 50 hfills in a space of 237 pixels, but who uses 
that? More than 3 are very unlikely.


Georg


Reply via email to