Revision: 7822
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7822&view=rev
Author:   mdboom
Date:     2009-09-24 17:03:13 +0000 (Thu, 24 Sep 2009)

Log Message:
-----------
Clip markers in draw_marker outside of the image rectangle with an extra border 
to accomodate the size of the marker.

Modified Paths:
--------------
    branches/v0_99_maint/src/_backend_agg.cpp

Modified: branches/v0_99_maint/src/_backend_agg.cpp
===================================================================
--- branches/v0_99_maint/src/_backend_agg.cpp   2009-09-24 04:02:07 UTC (rev 
7821)
+++ branches/v0_99_maint/src/_backend_agg.cpp   2009-09-24 17:03:13 UTC (rev 
7822)
@@ -599,6 +599,12 @@
     agg::serialized_scanlines_adaptor_aa8 sa;
     agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl;
 
+    agg::rect_d clipping_rect(
+      -(scanlines.min_x() + 1.0),
+      -(scanlines.min_y() + 1.0),
+      width + scanlines.max_x() + 1.0,
+      height + scanlines.max_y() + 1.0);
+
     if (has_clippath) {
       while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) {
         if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) {
@@ -607,13 +613,13 @@
 
         x = (double)(int)x; y = (double)(int)y;
 
-       // if x or y is close to the width or height, the filled
-       // region could be inside the boundary even if the center is
-       // out.  But at some point we need to cull these points
+        // Cull points outside the boundary of the image.  Values
+        // that are too large may overflow and create segfaults.
        // because they can create segfaults of they overflow; eg
-       // 
https://sourceforge.net/tracker/?func=detail&aid=2865490&group_id=80706&atid=560720
-       if (fabs(x)>(2*width)) continue;
-       if (fabs(y)>(2*height)) continue;
+       // 
http://sourceforge.net/tracker/?func=detail&aid=2865490&group_id=80706&atid=560720
+        if (!clipping_rect.hit_test(x, y)) {
+          continue;
+        }
 
        pixfmt_amask_type pfa(pixFmt, alphaMask);
        amask_ren_type r(pfa);
@@ -636,13 +642,13 @@
 
         x = (double)(int)x; y = (double)(int)y;
 
-       // if x or y is close to the width or height, the filled
-       // region could be inside the boundary even if the center is
-       // out.  But at some point we need to cull these points
+        // Cull points outside the boundary of the image.  Values
+        // that are too large may overflow and create segfaults.
        // because they can create segfaults of they overflow; eg
-       // 
https://sourceforge.net/tracker/?func=detail&aid=2865490&group_id=80706&atid=560720
-       if (fabs(x)>(2*width)) continue;
-       if (fabs(y)>(2*height)) continue;
+       // 
http://sourceforge.net/tracker/?func=detail&aid=2865490&group_id=80706&atid=560720
+        if (!clipping_rect.hit_test(x, y)) {
+          continue;
+        }
 
        if (face.first) {
          rendererAA.color(face.second);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Come build with us! The BlackBerry® Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9-12, 2009. Register now!
http://p.sf.net/sfu/devconf
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to