Revision: 6881 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6881&view=rev Author: mdboom Date: 2009年02月05日 15:35:24 +0000 (2009年2月05日) Log Message: ----------- Fix shortening end of path bug in simplifier. Speed up clipper by not using a queue. Modified Paths: -------------- trunk/matplotlib/src/path_converters.h Modified: trunk/matplotlib/src/path_converters.h =================================================================== --- trunk/matplotlib/src/path_converters.h 2009年02月05日 15:30:42 UTC (rev 6880) +++ trunk/matplotlib/src/path_converters.h 2009年02月05日 15:35:24 UTC (rev 6881) @@ -246,7 +246,7 @@ clipped, but are always included in their entirety. */ template<class VertexSource> -class PathClipper : protected EmbeddedQueue<2> +class PathClipper { VertexSource* m_source; bool m_do_clipping; @@ -254,6 +254,9 @@ double m_lastX; double m_lastY; bool m_moveto; + double m_nextX; + double m_nextY; + bool m_has_next; public: PathClipper(VertexSource& source, bool do_clipping, @@ -274,7 +277,8 @@ inline void rewind(unsigned path_id) { - queue_clear(); + m_has_next = false; + m_moveto = true; m_source->rewind(path_id); } @@ -283,18 +287,21 @@ unsigned code; if (m_do_clipping) { - // This is the slow path where we want to do clipping - if (queue_flush(&code, x, y)) - { - return code; + /* This is the slow path where we actually do clipping */ + + if (m_has_next) { + m_has_next = false; + *x = m_nextX; + *y = m_nextY; + return agg::path_cmd_line_to; } - while ((code = m_source->vertex(x, y)) != agg::path_cmd_stop) - { - if (code == agg::path_cmd_move_to || m_moveto) + while ((code = m_source->vertex(x, y)) != agg::path_cmd_stop) { + if (m_moveto) { m_moveto = false; - queue_push(agg::path_cmd_move_to, *x, *y); + code = agg::path_cmd_move_to; + break; } else if (code == agg::path_cmd_line_to) { @@ -303,7 +310,8 @@ y0 = m_lastY; x1 = *x; y1 = *y; - + m_lastX = *x; + m_lastY = *y; unsigned moved = agg::clip_line_segment(&x0, &y0, &x1, &y1, m_cliprect); // moved >= 4 - Fully clipped // moved != 0 - First point has been moved @@ -312,25 +320,26 @@ { if (moved & 1) { - queue_push(agg::path_cmd_move_to, x0, y0); + *x = x0; + *y = y0; + m_nextX = x1; + m_nextY = y1; + m_has_next = true; + return agg::path_cmd_move_to; } - queue_push(agg::path_cmd_line_to, x1, y1); + *x = x1; + *y = y1; + return code; } } else { - queue_push(code, *x, *y); + break; } - - m_lastX = *x; - m_lastY = *y; - - if (queue_flush(&code, x, y)) - { - return code; - } } + m_lastX = *x; + m_lastY = *y; return code; } else @@ -474,6 +483,7 @@ inline void rewind(unsigned path_id) { queue_clear(); + m_moveto = true; m_source->rewind(path_id); } @@ -664,6 +674,7 @@ { queue_push(agg::path_cmd_line_to, m_nextX, m_nextY); } + queue_push(agg::path_cmd_line_to, m_lastx, m_lasty); queue_push(agg::path_cmd_stop, 0.0, 0.0); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6892 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6892&view=rev Author: mdboom Date: 2009年02月09日 13:31:18 +0000 (2009年2月09日) Log Message: ----------- Remove extraneous "public:" Modified Paths: -------------- trunk/matplotlib/src/path_converters.h Modified: trunk/matplotlib/src/path_converters.h =================================================================== --- trunk/matplotlib/src/path_converters.h 2009年02月09日 13:15:45 UTC (rev 6891) +++ trunk/matplotlib/src/path_converters.h 2009年02月09日 13:31:18 UTC (rev 6892) @@ -366,7 +366,6 @@ template<class VertexSource> class PathQuantizer { - public: private: VertexSource* m_source; bool m_quantize; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6896 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6896&view=rev Author: mdboom Date: 2009年02月09日 20:06:32 +0000 (2009年2月09日) Log Message: ----------- Add comment about how nan-removal on curves works. Modified Paths: -------------- trunk/matplotlib/src/path_converters.h Modified: trunk/matplotlib/src/path_converters.h =================================================================== --- trunk/matplotlib/src/path_converters.h 2009年02月09日 18:49:49 UTC (rev 6895) +++ trunk/matplotlib/src/path_converters.h 2009年02月09日 20:06:32 UTC (rev 6896) @@ -151,6 +151,10 @@ bool needs_move_to = false; while (true) { + /* The approach here is to push each full curve + segment into the queue. If any non-finite values + are found along the way, the queue is emptied, and + the next curve segment is handled. */ code = m_source->vertex(x, y); if (code == agg::path_cmd_stop || code == (agg::path_cmd_end_poly | agg::path_flags_close)) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 6903 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6903&view=rev Author: mdboom Date: 2009年02月10日 16:09:38 +0000 (2009年2月10日) Log Message: ----------- Minor comment and indentation fixes. Modified Paths: -------------- trunk/matplotlib/src/path_converters.h Modified: trunk/matplotlib/src/path_converters.h =================================================================== --- trunk/matplotlib/src/path_converters.h 2009年02月10日 04:47:57 UTC (rev 6902) +++ trunk/matplotlib/src/path_converters.h 2009年02月10日 16:09:38 UTC (rev 6903) @@ -162,7 +162,8 @@ return code; } - if (needs_move_to) { + if (needs_move_to) + { queue_push(agg::path_cmd_move_to, *x, *y); } @@ -185,6 +186,9 @@ queue_clear(); + /* If the last point is finite, we use that for the + moveto, otherwise, we'll use the first vertex of + the next curve. */ if (!(MPL_notisfinite64(*x) || MPL_notisfinite64(*y))) { queue_push(agg::path_cmd_move_to, *x, *y); @@ -318,8 +322,8 @@ m_lastY = *y; unsigned moved = agg::clip_line_segment(&x0, &y0, &x1, &y1, m_cliprect); // moved >= 4 - Fully clipped - // moved != 0 - First point has been moved - // moved != 0 - Second point has been moved + // moved & 1 != 0 - First point has been moved + // moved & 2 != 0 - Second point has been moved if (moved < 4) { if (moved & 1) @@ -480,7 +484,7 @@ m_lastMax(false), m_nextX(0.0), m_nextY(0.0), m_lastWrittenX(0.0), m_lastWrittenY(0.0) { - // empty + // empty } inline void rewind(unsigned path_id) @@ -719,7 +723,8 @@ /* If we clipped some segments between this line and the next line we are starting, we also need to move to the last point. */ - if (m_clipped) { + if (m_clipped) + { queue_push(agg::path_cmd_move_to, m_lastx, m_lasty); } else if (!m_lastMax) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7058 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7058&view=rev Author: mdboom Date: 2009年04月23日 14:21:38 +0000 (2009年4月23日) Log Message: ----------- Fix some uninitialized variable errors in valgrind. Modified Paths: -------------- trunk/matplotlib/src/path_converters.h Modified: trunk/matplotlib/src/path_converters.h =================================================================== --- trunk/matplotlib/src/path_converters.h 2009年04月23日 14:20:27 UTC (rev 7057) +++ trunk/matplotlib/src/path_converters.h 2009年04月23日 14:21:38 UTC (rev 7058) @@ -270,7 +270,8 @@ 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(0.0, 0.0, width, height), m_moveto(true), + m_has_next(false) { // empty } @@ -278,7 +279,7 @@ PathClipper(VertexSource& source, bool do_clipping, const agg::rect_base<double>& rect) : m_source(&source), m_do_clipping(do_clipping), - m_cliprect(rect), m_moveto(true) + m_cliprect(rect), m_moveto(true), m_has_next(false) { // empty } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 7201 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7201&view=rev Author: mdboom Date: 2009年06月08日 13:37:03 +0000 (2009年6月08日) Log Message: ----------- Pixel-align even long sequences of rectilinear lines. Modified Paths: -------------- trunk/matplotlib/src/path_converters.h Modified: trunk/matplotlib/src/path_converters.h =================================================================== --- trunk/matplotlib/src/path_converters.h 2009年06月08日 12:57:17 UTC (rev 7200) +++ trunk/matplotlib/src/path_converters.h 2009年06月08日 13:37:03 UTC (rev 7201) @@ -390,7 +390,7 @@ switch (quantize_mode) { case QUANTIZE_AUTO: - if (total_vertices > 15) + if (total_vertices > 1024) { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Revision: 8462 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8462&view=rev Author: mdboom Date: 2010年06月24日 17:05:49 +0000 (2010年6月24日) 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.