[cairo] rewriting libpixman

Bill Spitzak spitzak at thefoundry.co.uk
Fri Jul 6 03:26:33 PDT 2007

Behdad Esfahbod wrote:

>> What isn't clear to me, is why one would prefer a truly uniform
>> distribution over having less error.
> I'm convinced now that multiplying by 2^n-1 and rounding makes more
> sense.  The only reason I see for preferring the current approach is
> that it can be made to run a lot faster. Dono if we should switch over.
> Carl?

Actually there are good arguments for the faster and uniform-distribution.

The problem is that most software and hardware that converts from a 
higher number of bits to a lower number does so by right shifting. Using 
other code to convert between bits (such as rounding to the nearest 
number of smaller bits) would disagree with far too much existing 
software and hardware. This would mean it would be impossible to match 
Cairo output to other programs seamlessly, and might make hardware 
acceleration impossible,

It is desirable that conversion from float to m bits and then to n bits 
(where m>n) is equal to conversion from float to n bits. This is only 
true if the conversion is multiplication by 2^n.

More information about the cairo mailing list