Notes on testing, and: Re: [cairo] Pattern rewrite

Kristian Høgsberg krh at bitplanet.net
Thu Jan 27 11:44:39 PST 2005


Kristian Høgsberg wrote:
...

> I added a new test case, 'clip_twice', which tests that the clipping 
> surface is updated properly when setting the clipping path twice.  This 
> test case found another bug in my patch and a bug in imagediff.  The 
> problem is that unpremultiplying alpha and then premultiplying alpha 
> again can't preserve the color channel values due to the precision loss 
> inherent in the premultiplied representation.  I.e. we map values from 
> 0-255 onto 0-alpha and then back to 0-255.  I'd suggest that we store 
> the reference images with premultiplied alpha, which means that they 
> won't be generally viewable, but I think that's the only way we can have 
> a pixel-perfect test suite.  It should be pretty easy to also output a 
> viewable PNG for visual inspection, but the imagediff should work on 
> PNGs with premultiplied alpha.

Bah, I had it the wrong way around: writing the PNG maps the color 
channels in the range 0-alpha into 0-255, reading it maps 0-255 back 
into 0-alpha.  This is doable without throwing away information, the 
problem was just a rounding error in the unpre- and pre-mulitiplication 
functions.  This is fixed in cvs now.

cheers,
Kristian



More information about the cairo mailing list