Path length in the cairo backend

Dear all,

The draw_path method in backend_cairo.py starts with a check for the number of vertices in the path, and raises an error if the path contains more than 18980 vertices:

     def draw_path(self, gc, path, transform, rgbFace=None):
         if len(path.vertices) > 18980:
             raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")

This was needed in the past when cairo version 1.4.10 / pycairo version 1.4.0 would segfault:

http://sourceforge.net/mailarchive/message.php?msg_name=487E2E78.1050501%40stsci.edu

However, we're now at cairo, pycairo version 1.8.8, and I haven't seen any segfaults after removing this check.

Does anybody object if I remove this check from the code?

--Michiel.

Can you write it in such a way that the check is only removed on cairo < 1.8? My employer is still standardized on RHEL4, for example, which has cairo 1.2.

Mike

Michiel de Hoon wrote:

···

Dear all,

The draw_path method in backend_cairo.py starts with a check for the number of vertices in the path, and raises an error if the path contains more than 18980 vertices:

     def draw_path(self, gc, path, transform, rgbFace=None):
         if len(path.vertices) > 18980:
             raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")

This was needed in the past when cairo version 1.4.10 / pycairo version 1.4.0 would segfault:

http://sourceforge.net/mailarchive/message.php?msg_name=487E2E78.1050501%40stsci.edu

However, we're now at cairo, pycairo version 1.8.8, and I haven't seen any segfaults after removing this check.

Does anybody object if I remove this check from the code?

--Michiel.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Sorry -- I meant remove the check for cairo >= 1.8.

Michael Droettboom wrote:

···

Can you write it in such a way that the check is only removed on cairo < 1.8? My employer is still standardized on RHEL4, for example, which has cairo 1.2.

Mike

Michiel de Hoon wrote:
  

Dear all,

The draw_path method in backend_cairo.py starts with a check for the number of vertices in the path, and raises an error if the path contains more than 18980 vertices:

     def draw_path(self, gc, path, transform, rgbFace=None):
         if len(path.vertices) > 18980:
             raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")

This was needed in the past when cairo version 1.4.10 / pycairo version 1.4.0 would segfault:

http://sourceforge.net/mailarchive/message.php?msg_name=487E2E78.1050501%40stsci.edu

However, we're now at cairo, pycairo version 1.8.8, and I haven't seen any segfaults after removing this check.

Does anybody object if I remove this check from the code?

--Michiel.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
  
--
Michael Droettboom
Science Software Branch
Operations and Engineering Division
Space Telescope Science Institute
Operated by AURA for NASA

Michiel de Hoon wrote:

Dear all,

The draw_path method in backend_cairo.py starts with a check for the number of vertices in the path, and raises an error if the path contains more than 18980 vertices:

     def draw_path(self, gc, path, transform, rgbFace=None):
         if len(path.vertices) > 18980:
             raise ValueError("The Cairo backend can not draw paths longer than 18980 points.")

This was needed in the past when cairo version 1.4.10 / pycairo version 1.4.0 would segfault:

http://sourceforge.net/mailarchive/message.php?msg_name=487E2E78.1050501%40stsci.edu

However, we're now at cairo, pycairo version 1.8.8, and I haven't seen any segfaults after removing this check.

Is path simplification in effect? If so, have you tested after turning simplification off, so that you can be sure how many points cairo is trying to plot?

Eric

···

Does anybody object if I remove this check from the code?

--Michiel.

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Yes I tried without path simplification, and I don't get any crashes. If we need to support older versions of cairo / pycairo, I suggest that we have the path length check after checking the version of cairo / pycairo, and that we perform the path length check after path simplification, so we know how many points will actually be drawn.

--Michiel.

···

--- On Mon, 2/22/10, Eric Firing <efiring@...229...> wrote:

From: Eric Firing <efiring@...229...>
Subject: Re: [matplotlib-devel] Path length in the cairo backend
To: "Michiel de Hoon" <mjldehoon@...42...>
Cc: matplotlib-devel@lists.sourceforge.net
Date: Monday, February 22, 2010, 1:00 PM
Michiel de Hoon wrote:
> Dear all,
>
> The draw_path method in backend_cairo.py starts with a
check for the number of vertices in the path, and raises an
error if the path contains more than 18980 vertices:
>
> def draw_path(self, gc, path,
transform, rgbFace=None):
> if
len(path.vertices) > 18980:
> raise
ValueError("The Cairo backend can not draw paths longer than
18980 points.")
>
> This was needed in the past when cairo version 1.4.10
/ pycairo version 1.4.0 would segfault:
>
> http://sourceforge.net/mailarchive/message.php?msg_name=487E2E78.1050501%40stsci.edu
>
> However, we're now at cairo, pycairo version 1.8.8,
and I haven't seen any segfaults after removing this check.
>

Is path simplification in effect? If so, have you
tested after turning simplification off, so that you can be
sure how many points cairo is trying to plot?

Eric

> Does anybody object if I remove this check from the
code?
>
> --Michiel.
>
>
>
>
>
------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed
compiling, find bugs
> proactively, and fine-tune applications for parallel
performance.
> See why Intel Parallel Studio got high marks during
beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Matplotlib-devel mailing list
> Matplotlib-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

When testing the cairo backend on Mac OS X, I did experience crashes with long path lengths even with the current version (1.8.8) of cairo / pycairo. So the path length check is still needed. I put it back in.

--Michiel.

···

--- On Mon, 2/22/10, Michiel de Hoon <mjldehoon@...42...> wrote:

From: Michiel de Hoon <mjldehoon@...42...>
Subject: Re: [matplotlib-devel] Path length in the cairo backend
To: "Eric Firing" <efiring@...229...>
Cc: matplotlib-devel@lists.sourceforge.net
Date: Monday, February 22, 2010, 9:09 PM
Yes I tried without path
simplification, and I don't get any crashes. If we need to
support older versions of cairo / pycairo, I suggest that we
have the path length check after checking the version of
cairo / pycairo, and that we perform the path length check
after path simplification, so we know how many points will
actually be drawn.

--Michiel.

--- On Mon, 2/22/10, Eric Firing <efiring@...229...> > wrote:

> From: Eric Firing <efiring@...229...>
> Subject: Re: [matplotlib-devel] Path length in the
cairo backend
> To: "Michiel de Hoon" <mjldehoon@...42...>
> Cc: matplotlib-devel@lists.sourceforge.net
> Date: Monday, February 22, 2010, 1:00 PM
> Michiel de Hoon wrote:
> > Dear all,
> >
> > The draw_path method in backend_cairo.py starts
with a
> check for the number of vertices in the path, and
raises an
> error if the path contains more than 18980 vertices:
> >
> > def draw_path(self, gc, path,
> transform, rgbFace=None):
> > if
> len(path.vertices) > 18980:
> > raise
> ValueError("The Cairo backend can not draw paths
longer than
> 18980 points.")
> >
> > This was needed in the past when cairo version
1.4.10
> / pycairo version 1.4.0 would segfault:
> >
> > http://sourceforge.net/mailarchive/message.php?msg_name=487E2E78.1050501%40stsci.edu
> >
> > However, we're now at cairo, pycairo version
1.8.8,
> and I haven't seen any segfaults after removing this
check.
> >
>
> Is path simplification in effect? If so, have you
> tested after turning simplification off, so that you
can be
> sure how many points cairo is trying to plot?
>
> Eric
>
>
> > Does anybody object if I remove this check from
the
> code?
> >
> > --Michiel.
> >
> >
> >
> >
> >
>
------------------------------------------------------------------------------
> > Download Intel® Parallel Studio Eval
> > Try the new software tools for yourself. Speed
> compiling, find bugs
> > proactively, and fine-tune applications for
parallel
> performance.
> > See why Intel Parallel Studio got high marks
during
> beta.
> > http://p.sf.net/sfu/intel-sw-dev
> > _______________________________________________
> > Matplotlib-devel mailing list
> > Matplotlib-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/matplotlib-devel
>
>

------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling,
find bugs
proactively, and fine-tune applications for parallel
performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel