SF.net SVN: matplotlib:[8461] trunk/matplotlib
Revision: 8461
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8461&view=rev
Author: mdboom
Date: 2010-06-24 14:48:00 + (Thu, 24 Jun 2010)
Log Message:
---
[3020704] set_xlim() problem
Bug in PathClipper when vertices fall precisely on the clipping edge.
Modified Paths:
--
trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
trunk/matplotlib/src/path_converters.h
Added Paths:
---
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg
Added:
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf
===
(Binary files differ)
Property changes on:
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.pdf
___
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png
===
(Binary files differ)
Property changes on:
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.png
___
Added: svn:mime-type
+ application/octet-stream
Added:
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg
===
---
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg
(rev 0)
+++
trunk/matplotlib/lib/matplotlib/tests/baseline_images/test_simplification/clipper_edge.svg
2010-06-24 14:48:00 UTC (rev 8461)
@@ -0,0 +1,104 @@
+
+http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";>
+
+http://www.w3.org/2000/svg";
+ xmlns:xlink="http://www.w3.org/1999/xlink";
+ version="1.1"
+ id="svg1">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Modified: trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
===
--- trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
2010-06-24 13:06:03 UTC (rev 8460)
+++ trunk/matplotlib/lib/matplotlib/tests/test_simplification.py
2010-06-24 14:48:00 UTC (rev 8461)
@@ -186,7 +186,24 @@
else:
rcParams['path.simplify'] = True
+...@image_comparison(baseline_images=['clipper_edge'])
+def test_clipper():
+dat = (0, 1, 0, 2, 0, 3, 0, 4, 0, 5)
+fig = plt.figure(figsize=(2, 1))
+fig.subplots_adjust(left = 0, bottom = 0, wspace = 0, hspace = 0)
+ax = fig.add_axes((0, 0, 1.0, 1.0), ylim = (0, 5), autoscale_on = False)
+ax.plot(dat)
+ax.xaxis.set_major_locator(plt.MultipleLocator(1))
+ax.xaxis.set_major_formatter(plt.NullFormatter())
+ax.yaxis.set_major_locator(plt.MultipleLocator(1))
+ax.yaxis.set_major_formatter(plt.NullFormatter())
+ax.xaxis.set_ticks_position('bottom')
+ax.yaxis.set_ticks_position('left')
+
+ax.set_xlim(5, 9)
+fig.savefig('clipper_edge')
+
if __name__=='__main__':
import nose
nose.runmodule(argv=['-s','--with-doctest'], exit=False)
Modified: trunk/matplotlib/src/path_converters.h
===
--- trunk/matplotlib/src/path_converters.h 2010-06-24 13:06:03 UTC (rev
8460)
+++ trunk/matplotlib/src/path_converters.h 2010-06-24 14:48:00 UTC (rev
8461)
@@ -288,7 +288,7 @@
PathClipper(VertexSource& source, bool do_clipping,
double width, double height) :
m_source(&source), m_do_clipping(do_clipping),
-m_cliprect(0.0, 0.0, width, height), m_moveto(true),
+m_cliprect(-1.0, -1.0, width + 1.0, height + 1.0), m_moveto(true),
m_has_next(false)
{
// empty
@@ -296,10 +296,13 @@
PathClipper(VertexSource& source, bool do_clipping,
const agg::rect_base& rect) :
-m_source(&source), m_do_clipping(do_clipping),
-m_cliprect(rect), m_moveto(true), m_has_next(false)
+m_source(&source), m_do_clipping(do_clipping),
+m_cliprect(rect), m_moveto(true), m_has_next(false)
{
-// empty
+m_cliprect.x1 -= 1.0;
+m_cliprect.y1 -= 1.0;
+m_cliprect.x2 += 1.0;
+m_cliprect.y2 += 1.0;
}
inline void
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
SF.net SVN: matplotlib:[8462] trunk/matplotlib/src/path_converters.h
Revision: 8462
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8462&view=rev
Author: mdboom
Date: 2010-06-24 17:05:49 + (Thu, 24 Jun 2010)
Log Message:
---
Use the more standard term "pop" rather than "flush" for removing the next item
from the queue.
Modified Paths:
--
trunk/matplotlib/src/path_converters.h
Modified: trunk/matplotlib/src/path_converters.h
===
--- trunk/matplotlib/src/path_converters.h 2010-06-24 14:48:00 UTC (rev
8461)
+++ trunk/matplotlib/src/path_converters.h 2010-06-24 17:05:49 UTC (rev
8462)
@@ -88,7 +88,7 @@
}
inline bool
-queue_flush(unsigned *cmd, double *x, double *y)
+queue_pop(unsigned *cmd, double *x, double *y)
{
if (queue_nonempty())
{
@@ -159,7 +159,7 @@
if (m_has_curves)
{
/* This is the slow method for when there might be curves. */
-if (queue_flush(&code, x, y))
+if (queue_pop(&code, x, y))
{
return code;
}
@@ -216,7 +216,7 @@
}
}
-if (queue_flush(&code, x, y))
+if (queue_pop(&code, x, y))
{
return code;
}
@@ -567,7 +567,7 @@
the queue before proceeding to the main loop below.
-- Michael Droettboom */
-if (queue_flush(&cmd, x, y))
+if (queue_pop(&cmd, x, y))
{
return cmd;
}
@@ -740,7 +740,7 @@
/* Return the first item in the queue, if any, otherwise
indicate that we're done. */
-if (queue_flush(&cmd, x, y))
+if (queue_pop(&cmd, x, y))
{
return cmd;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[8463] trunk/matplotlib/src/_backend_agg.cpp
Revision: 8463
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8463&view=rev
Author: mdboom
Date: 2010-06-24 17:12:26 + (Thu, 24 Jun 2010)
Log Message:
---
Clipping to the figure rectangle doesn't work on curves, so turn it off in that
case.
Modified Paths:
--
trunk/matplotlib/src/_backend_agg.cpp
Modified: trunk/matplotlib/src/_backend_agg.cpp
===
--- trunk/matplotlib/src/_backend_agg.cpp 2010-06-24 17:05:49 UTC (rev
8462)
+++ trunk/matplotlib/src/_backend_agg.cpp 2010-06-24 17:12:26 UTC (rev
8463)
@@ -1304,7 +1304,7 @@
trans *= agg::trans_affine_scaling(1.0, -1.0);
trans *= agg::trans_affine_translation(0.0, (double)height);
-bool clip = !face.first && gc.hatchpath.isNone();
+bool clip = !face.first && gc.hatchpath.isNone() && !path.has_curves();
bool simplify = path.should_simplify() && clip;
transformed_path_t tpath(path, trans);
@@ -1498,7 +1498,7 @@
}
}
-bool do_clip = !face.first && gc.hatchpath.isNone();
+bool do_clip = !face.first && gc.hatchpath.isNone() && !has_curves;
if (check_snap)
{
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[8464] trunk/matplotlib/src
Revision: 8464
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8464&view=rev
Author: mdboom
Date: 2010-06-24 17:59:48 + (Thu, 24 Jun 2010)
Log Message:
---
Speed up Gouraud shading in Agg backend.
Modified Paths:
--
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_backend_agg.h
Modified: trunk/matplotlib/src/_backend_agg.cpp
===
--- trunk/matplotlib/src/_backend_agg.cpp 2010-06-24 17:12:26 UTC (rev
8463)
+++ trunk/matplotlib/src/_backend_agg.cpp 2010-06-24 17:59:48 UTC (rev
8464)
@@ -1824,19 +1824,15 @@
}
void
-RendererAgg::_draw_gouraud_triangle(const GCAgg& gc, const double* points,
+RendererAgg::_draw_gouraud_triangle(const double* points,
const double* colors,
-agg::trans_affine trans)
+agg::trans_affine trans,
+bool has_clippath)
{
typedef agg::rgba8 color_t;
typedef agg::span_gouraud_rgbaspan_gen_t;
typedef agg::span_allocator span_alloc_t;
-theRasterizer.reset_clipping();
-rendererBase.reset_clipping(true);
-set_clipbox(gc.cliprect, theRasterizer);
-bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
-
trans *= agg::trans_affine_scaling(1.0, -1.0);
trans *= agg::trans_affine_translation(0.0, (double)height);
@@ -1897,6 +1893,11 @@
PyArrayObject* points = NULL;
PyArrayObject* colors = NULL;
+theRasterizer.reset_clipping();
+rendererBase.reset_clipping(true);
+set_clipbox(gc.cliprect, theRasterizer);
+bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
+
try
{
points = (PyArrayObject*)PyArray_ContiguousFromAny
@@ -1916,7 +1917,8 @@
}
_draw_gouraud_triangle(
-gc, (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors),
trans);
+ (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors),
+ trans, has_clippath);
}
catch (...)
{
@@ -1951,6 +1953,11 @@
PyArrayObject* points = NULL;
PyArrayObject* colors = NULL;
+theRasterizer.reset_clipping();
+rendererBase.reset_clipping(true);
+set_clipbox(gc.cliprect, theRasterizer);
+bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
+
try
{
points = (PyArrayObject*)PyArray_ContiguousFromAny
@@ -1976,7 +1983,9 @@
for (int i = 0; i < PyArray_DIM(points, 0); ++i)
{
-_draw_gouraud_triangle(gc, (double*)PyArray_GETPTR1(points, i),
(double*)PyArray_GETPTR1(colors, i), trans);
+_draw_gouraud_triangle(
+ (double*)PyArray_GETPTR1(points, i),
+ (double*)PyArray_GETPTR1(colors, i), trans, has_clippath);
}
}
catch (...)
Modified: trunk/matplotlib/src/_backend_agg.h
===
--- trunk/matplotlib/src/_backend_agg.h 2010-06-24 17:12:26 UTC (rev 8463)
+++ trunk/matplotlib/src/_backend_agg.h 2010-06-24 17:59:48 UTC (rev 8464)
@@ -263,8 +263,8 @@
void
_draw_gouraud_triangle(
-const GCAgg& gc,
-const double* points, const double* colors, agg::trans_affine trans);
+const double* points, const double* colors,
+agg::trans_affine trans, bool has_clippath);
private:
void create_alpha_buffers();
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
--
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
___
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
SF.net SVN: matplotlib:[8465] trunk/matplotlib/agg24/include/agg_scanline_u .h
Revision: 8465 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8465&view=rev Author: mdboom Date: 2010-06-24 18:25:16 + (Thu, 24 Jun 2010) Log Message: --- [3018198] Fixing the build with clang Typo in agg causes a template instantiation bug on compilers that actually instantiate everything. Modified Paths: -- trunk/matplotlib/agg24/include/agg_scanline_u.h Modified: trunk/matplotlib/agg24/include/agg_scanline_u.h === --- trunk/matplotlib/agg24/include/agg_scanline_u.h 2010-06-24 17:59:48 UTC (rev 8464) +++ trunk/matplotlib/agg24/include/agg_scanline_u.h 2010-06-24 18:25:16 UTC (rev 8465) @@ -2,8 +2,8 @@ // Anti-Grain Geometry - Version 2.4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) // -// Permission to copy, use, modify, sell and distribute this software -// is granted provided this copyright notice appears in all copies. +// Permission to copy, use, modify, sell and distribute this software +// is granted provided this copyright notice appears in all copies. // This software is provided "as is" without express or implied // warranty, and with no claim as to its suitability for any purpose. // @@ -13,12 +13,12 @@ // http://www.antigrain.com // // -// Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by +// Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by // Liberty Technology Systems, Inc., visit http://lib-sys.com // // Liberty Technology Systems, Inc. is the provider of // PostScript and PDF technology for software developers. -// +// // #ifndef AGG_SCANLINE_U_INCLUDED @@ -32,22 +32,22 @@ // // Unpacked scanline container class // -// This class is used to transfer data from a scanline rasterizer -// to the rendering buffer. It's organized very simple. The class stores -// information of horizontal spans to render it into a pixel-map buffer. -// Each span has staring X, length, and an array of bytes that determine the -// cover-values for each pixel. -// Before using this class you should know the minimal and maximal pixel +// This class is used to transfer data from a scanline rasterizer +// to the rendering buffer. It's organized very simple. The class stores +// information of horizontal spans to render it into a pixel-map buffer. +// Each span has staring X, length, and an array of bytes that determine the +// cover-values for each pixel. +// Before using this class you should know the minimal and maximal pixel // coordinates of your scanline. The protocol of using is: // 1. reset(min_x, max_x) -// 2. add_cell() / add_span() - accumulate scanline. +// 2. add_cell() / add_span() - accumulate scanline. //When forming one scanline the next X coordinate must be always greater //than the last stored one, i.e. it works only with ordered coordinates. // 3. Call finalize(y) and render the scanline. // 3. Call reset_spans() to prepare for the new scanline. -// +// // 4. Rendering: -// +// // Scanline provides an iterator class that allows you to extract // the spans and the cover values for each pixel. Be aware that clipping // has not been done yet, so you should perform it yourself. @@ -61,10 +61,10 @@ // // // scanline_u8::const_iterator span = sl.begin(); -// -// unsigned char* row = m_rbuf->row(y); // The the address of the beginning +// +// unsigned char* row = m_rbuf->row(y); // The the address of the beginning // // of the current row -// +// // unsigned num_spans = sl.num_spans(); // Number of spans. It's guaranteed that // // num_spans is always greater than 0. // @@ -75,7 +75,7 @@ // // int num_pix = span->len; // Number of pixels of the span. // // Always greater than 0, still it's -// // better to use "int" instead of +// // better to use "int" instead of // // "unsigned" because it's more // // convenient for clipping // int x = span->x; @@ -86,24 +86,24 @@ // ** // // unsigned char* dst = row + x; // Calculate the start address of the row. -//// In this case we assume a simple +//
SF.net SVN: matplotlib:[8466] trunk/matplotlib/lib/matplotlib/backends/ backend_gtk.py
Revision: 8466 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8466&view=rev Author: efiring Date: 2010-06-24 21:17:30 + (Thu, 24 Jun 2010) Log Message: --- backend_gtk: don't use idle events for draw_rubberband. Use of idle events for draw_rubberband was a peculiarity of backend_gtk. When using zoom-to-rect, it often caused a rubberband draw event to occur after the canvas redraw at the end of the zoom, leaving the canvas showing the state before the zoom action instead of showing the result of the action. Modified Paths: -- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py Modified: trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py === --- trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2010-06-24 18:25:16 UTC (rev 8465) +++ trunk/matplotlib/lib/matplotlib/backends/backend_gtk.py 2010-06-24 21:17:30 UTC (rev 8466) @@ -611,11 +611,9 @@ self.win = window gtk.Toolbar.__init__(self) NavigationToolbar2.__init__(self, canvas) -self._idle_draw_id = 0 def set_message(self, s): -if self._idle_draw_id == 0: -self.message.set_label(s) +self.message.set_label(s) def set_cursor(self, cursor): self.canvas.window.set_cursor(cursord[cursor]) @@ -644,7 +642,8 @@ h = abs(y1 - y0) rect = [int(val)for val in min(x0,x1), min(y0, y1), w, h] -try: lastrect, imageBack = self._imageBack +try: +lastrect, imageBack = self._imageBack except AttributeError: #snap image back if event.inaxes is None: @@ -655,16 +654,9 @@ b = int(height)-(b+h) axrect = l,b,w,h self._imageBack = axrect, drawable.get_image(*axrect) -drawable.draw_rectangle(gc, False, *rect) -self._idle_draw_id = 0 else: -def idle_draw(*args): -drawable.draw_image(gc, imageBack, 0, 0, *lastrect) -drawable.draw_rectangle(gc, False, *rect) -self._idle_draw_id = 0 -return False -if self._idle_draw_id == 0: -self._idle_draw_id = gobject.idle_add(idle_draw) +drawable.draw_image(gc, imageBack, 0, 0, *lastrect) +drawable.draw_rectangle(gc, False, *rect) def _init_toolbar(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. -- ThinkGeek and WIRED's GeekDad team up for the Ultimate GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the lucky parental unit. See the prize list and enter to win: http://p.sf.net/sfu/thinkgeek-promo ___ Matplotlib-checkins mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins
