[cairo] Firefox/Gtk3 - possible cairo clipping bug

Martin Stransky stransky at redhat.com
Mon Jul 22 23:46:17 PDT 2013


Problem found.

There are a cairo path left - a big rectangle from previous rendering 
and the new clipping path is inside it.

So the clipping is applied to the bigger rectangle instead of the inner 
clipping path. Not sure what's the correct behavior here.

ma.

On 07/22/2013 12:08 PM, Martin Stransky wrote:
> On 20.7.2013 13:47, Uli Schlachter wrote:
> [...]
>> Doesn't Mozilla bundle its own copy of cairo? How does this even work?
>> Firefox would use its own copy of cairo while Gtk3 links against
>> libcairo and
>> uses another version.
>>
>> AFAIR there is some pre-processor magic to rename the symbols of the
>> bundled
>> cairo copy, but does anything make sure that no cairo state is passed
>> between
>> the bundled and the system cairo copy?
>>
>> (I don't think that this has anything to do with the issue at hand,
>> because I
>> would expect crashes if something goes wrong here. This question just
>> came to my
>> mind.)
>
> Hi,
>
> Mozilla can use both - embedded one or system one. The Firefox Gtk3 port
> uses the system cairo, because as you point it those two can't be mixed.
>
>>> Do you guys have an idea where should I look at? Any debugging hints?
>> [...]
>>
>> If you think that you are seeing a cairo issue, it might be
>> interesting to know
>> which cairo version you are using and if you also tried older/newer
>> cairo versions.
>>
>> Also, assuming you are using cairo-xlib, it might be worth a try to set
>> CAIRO_DEBUG=xrender-version=-1.-1 or CAIRO_DEBUG=xrender-version=0.0
>> in the
>> environment. This should cause quite different code paths to be used
>> inside of
>> cairo.
>>
>> However, in comment [0] this doesn't sound like a cairo bug. I would
>> be really
>> surprised if cairo_clip() somehow accidentally loses a clip and would
>> start
>> producing a "no-clip" result.
>>
>> Perhaps it would be a good start to step through the last cairo_clip()
>> call and
>> check how the clip got lost. This code is quite simple and basically
>> just calls
>> into _cairo_clip_intersect_path() which handles all complicated cases
>> by copying
>> the path and adding to the list of clip paths. Not much that can go
>> wrong here...
>
> Thanks a lot for those tips! I have done some debugging in cairo_paint()
> and it looks like the clip is not applied - there are only two clipping
> edges (IIRC the way contains 8 edges) in cairo_paint().
>
> However I don't fully understand how the clipping polygon is
> constructed/applied but the two edges does not look correct (I compared
> correct and incorrect code paths with the same rendering parameters).
>
> But there's something in Firefox/cairo/gtk which causes the clipping
> (set by cairo_clip()) is ignored - it fails only once in fifteen times.
>
> I'm going to debug more it and keep you updated.
>
> Thanks!
> ma.
>
>



More information about the cairo mailing list