Bug 55706

Summary: pattern_create_linear with pattern_add_color_stop_rgba with offset 0.5 failed
Product: cairo Reporter: Volker <volkerobhof>
Component: pdf backendAssignee: Adrian Johnson <ajohnson>
Status: RESOLVED FIXED QA Contact: cairo-bugs mailing list <cairo-bugs>
Severity: normal    
Priority: medium    
Version: 1.10.2   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: pattern bug example
working example of pattern
working view
bugged view adobe
bug view evince

Description Volker 2012-10-06 22:04:10 UTC
Created attachment 68176 [details]
pattern bug example

There is a bug by creating a line with 

cairo_pattern_create_linear() and cairo_pattern_add_color_stop_rgba().

If the offset of cairo_pattern_add_color_stop_rgba() in the first call is 0.0 and in the other 1.0 it works fine with Adobe Acrobat Reader and Evince document viewer on ubuntu 12.04.

If I set the offset to 0.5 on both function calls in Adobe Acrobat Reader  and in Evince document viewer the line disappears also on Ubuntu 12.04.

I also attached the example as source code and views from document viewers.

This bug has no effect on png outputs.
Comment 1 Volker 2012-10-06 22:04:53 UTC
Created attachment 68177 [details]
working example of pattern
Comment 2 Volker 2012-10-06 22:06:37 UTC
Created attachment 68178 [details]
working view
Comment 3 Volker 2012-10-06 22:07:03 UTC
Created attachment 68179 [details]
bugged view adobe
Comment 4 Volker 2012-10-06 22:07:58 UTC
Created attachment 68180 [details]
bug view evince
Comment 5 Uli Schlachter 2012-10-07 11:38:09 UTC
Can't reproduce with git/master, bug was already fixed.

Git bisect finds (which is commit 1.10.0-231-g3cbe82f aka 1.11.2~98, so anything 1.11.2 or newer should be fine):

commit 3cbe82fe586f64dd11a0b2bc9f58619968965369
Author: Andrea Canciani <ranma42@gmail.com>
Date:   Sun Dec 12 22:29:56 2010 +0000

    ps,pdf: Deal with empty domain gradients.
    
    If all the stops of the gradient have the same offset and the
    pattern's extend mode is EXTEND_PAD, then we cannot use the stops'
    domain as the interpolation parameter range because this would produce
    a gradient with the same start and end objects.  Such ranges tickle
    bad behaviour in rasterisers.
    
    We replace the color function with an appropriate step function
    defined on [0 1].
    
    Fixes radial-gradient-one-stop for pdf and ps3.
    
    Reviewed-by: M Joonas Pihlaja <jpihlaja@cc.helsinki.fi>

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.