From: <md...@us...> - 2008-08-04 13:11:51
|
Revision: 5963 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5963&view=rev Author: mdboom Date: 2008-08-04 13:11:45 +0000 (Mon, 04 Aug 2008) Log Message: ----------- Speed improvements in quadmesh. Proper ref-counting in error case. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-08-04 13:09:02 UTC (rev 5962) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-08-04 13:11:45 UTC (rev 5963) @@ -1214,8 +1214,8 @@ private: inline unsigned vertex(unsigned idx, double* x, double* y) { - size_t m = (idx & 0x2) ? (m_m + 1) : m_m; - size_t n = (idx+1 & 0x2) ? (m_n + 1) : m_n; + size_t m = m_m + ((idx & 0x2) >> 1); + size_t n = m_n + ((idx+1 & 0x2) >> 1); double* pair = (double*)PyArray_GETPTR2(m_coordinates, n, m); *x = *pair++; *y = *pair; @@ -1243,7 +1243,7 @@ inline QuadMeshGenerator(size_t meshWidth, size_t meshHeight, PyObject* coordinates) : m_meshWidth(meshWidth), m_meshHeight(meshHeight), m_coordinates(NULL) { - PyArrayObject* coordinates_array = (PyArrayObject*)PyArray_FromObject(coordinates, PyArray_DOUBLE, 3, 3); + PyArrayObject* coordinates_array = (PyArrayObject*)PyArray_ContiguousFromObject(coordinates, PyArray_DOUBLE, 3, 3); if (!coordinates_array) { throw Py::ValueError("Invalid coordinates array."); } @@ -1310,23 +1310,27 @@ } } - _draw_path_collection_generic<QuadMeshGenerator, 0, 0> - (master_transform, - cliprect, - clippath, - clippath_trans, - path_generator, - transforms_obj, - offsets_obj, - offset_trans, - facecolors_obj, - edgecolors_obj, - linewidths, - linestyles_obj, - antialiaseds); + try { + _draw_path_collection_generic<QuadMeshGenerator, 0, 0> + (master_transform, + cliprect, + clippath, + clippath_trans, + path_generator, + transforms_obj, + offsets_obj, + offset_trans, + facecolors_obj, + edgecolors_obj, + linewidths, + linestyles_obj, + antialiaseds); + } catch (...) { + if (free_edgecolors) Py_XDECREF(edgecolors_obj.ptr()); + throw; + } - if (free_edgecolors) - Py_XDECREF(edgecolors_obj.ptr()); + if (free_edgecolors) Py_XDECREF(edgecolors_obj.ptr()); return Py::Object(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-08-11 13:01:52
|
Revision: 6019 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6019&view=rev Author: mdboom Date: 2008-08-11 13:01:47 +0000 (Mon, 11 Aug 2008) Log Message: ----------- Snapping bug in last commit. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-08-11 12:48:50 UTC (rev 6018) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-08-11 13:01:47 UTC (rev 6019) @@ -387,7 +387,7 @@ double x0, y0, x1, y1; unsigned code; - if (!path.should_simplify() || path.total_vertices() > 15) + if (path.total_vertices() > 15) return false; code = path.vertex(&x0, &y0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-10-24 14:55:19
|
Revision: 6319 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6319&view=rev Author: mdboom Date: 2008-10-24 14:55:14 +0000 (Fri, 24 Oct 2008) Log Message: ----------- Remove unnecessary declaration. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-10-24 14:05:07 UTC (rev 6318) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-10-24 14:55:14 UTC (rev 6319) @@ -823,7 +823,6 @@ typedef agg::image_accessor_clip<agg::pixfmt_rgba32> image_accessor_type; typedef agg::span_interpolator_linear<> interpolator_type; typedef agg::span_image_filter_rgba_nn<image_accessor_type, interpolator_type> image_span_gen_type; - typedef agg::renderer_scanline_aa_solid<amask_ren_type> amask_aa_renderer_type; typedef agg::renderer_scanline_aa<amask_ren_type, color_span_alloc_type, image_span_gen_type> renderer_type; color_span_alloc_type sa; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-10-27 19:40:27
|
Revision: 6339 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6339&view=rev Author: mdboom Date: 2008-10-27 19:40:25 +0000 (Mon, 27 Oct 2008) Log Message: ----------- Removed TODO (this has been implemented). Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-10-27 18:52:41 UTC (rev 6338) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-10-27 19:40:25 UTC (rev 6339) @@ -775,7 +775,6 @@ } -// MGDTODO: Support clip paths Py::Object RendererAgg::draw_image(const Py::Tuple& args) { _VERBOSE("RendererAgg::draw_image"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-10-30 14:56:54
|
Revision: 6356 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6356&view=rev Author: mdboom Date: 2008-10-30 14:56:51 +0000 (Thu, 30 Oct 2008) Log Message: ----------- Improve appearance of markers in Agg backend. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-10-30 14:33:30 UTC (rev 6355) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-10-30 14:56:51 UTC (rev 6356) @@ -490,7 +490,9 @@ trans *= agg::trans_affine_translation(0.0, (double)height); PathIterator marker_path(marker_path_obj); - bool marker_snap = should_snap(marker_path, marker_trans); + // The built-in markers look better if snapping is turned on. + const bool marker_snap = true; + // bool marker_snap = should_snap(marker_path, marker_trans); transformed_path_t marker_path_transformed(marker_path, marker_trans); simplify_t marker_path_simplified(marker_path_transformed, marker_snap, false, width, height); curve_t marker_path_curve(marker_path_simplified); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jd...@us...> - 2008-11-21 18:20:03
|
Revision: 6431 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6431&view=rev Author: jdh2358 Date: 2008-11-21 18:20:00 +0000 (Fri, 21 Nov 2008) Log Message: ----------- raise on out of range text location in backend agg Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-11-21 16:52:25 UTC (rev 6430) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-11-21 18:20:00 UTC (rev 6431) @@ -686,9 +686,8 @@ y = Py::Int( args[2] ); } catch (Py::TypeError) { - //x,y out of range; todo issue warning? Py_XDECREF(image_array); - return Py::Object(); + throw Py::TypeError("Invalid input arguments to draw_text_image"); } double angle = Py::Float( args[3] ); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-01 15:23:52
|
Revision: 6462 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6462&view=rev Author: mdboom Date: 2008-12-01 15:23:49 +0000 (Mon, 01 Dec 2008) Log Message: ----------- Fix disappearing small markers problem. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-12-01 14:51:35 UTC (rev 6461) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-12-01 15:23:49 UTC (rev 6462) @@ -493,9 +493,11 @@ trans *= agg::trans_affine_translation(0.0, (double)height); PathIterator marker_path(marker_path_obj); - // The built-in markers look better if snapping is turned on. - const bool marker_snap = true; - // bool marker_snap = should_snap(marker_path, marker_trans); + // The built-in markers look better if snapping is turned on, but + // unfortunately, it can cause really small things to disappear. + // Disabling for now to revisit at a later date. + // const bool marker_snap = true; + bool marker_snap = should_snap(marker_path, marker_trans); transformed_path_t marker_path_transformed(marker_path, marker_trans); simplify_t marker_path_simplified(marker_path_transformed, marker_snap, false, width, height); curve_t marker_path_curve(marker_path_simplified); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-02 15:27:28
|
Revision: 6466 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6466&view=rev Author: mdboom Date: 2008-12-02 15:27:23 +0000 (Tue, 02 Dec 2008) Log Message: ----------- Remove one-pixel offset in clipbox code. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-12-01 19:35:39 UTC (rev 6465) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-12-02 15:27:23 UTC (rev 6466) @@ -312,8 +312,8 @@ double l, b, r, t; if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) { - rasterizer.clip_box(int(mpl_round(l)) + 1, height - int(mpl_round(b)), - int(mpl_round(r)), height - int(mpl_round(t))); + rasterizer.clip_box(int(mpl_round(l)), height - int(mpl_round(b)), + int(mpl_round(r)), height - int(mpl_round(t))); } _VERBOSE("RendererAgg::set_clipbox done"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2008-12-08 16:10:52
|
Revision: 6512 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6512&view=rev Author: mdboom Date: 2008-12-08 16:10:50 +0000 (Mon, 08 Dec 2008) Log Message: ----------- Fix tick alignment in colorbars. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2008-12-08 15:30:56 UTC (rev 6511) +++ trunk/matplotlib/src/_backend_agg.cpp 2008-12-08 16:10:50 UTC (rev 6512) @@ -555,6 +555,8 @@ if (has_clippath) { while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) { + x = mpl_round(x); y = mpl_round(y); + pixfmt_amask_type pfa(pixFmt, alphaMask); amask_ren_type r(pfa); amask_aa_renderer_type ren(r); @@ -570,6 +572,8 @@ } } else { while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) { + x = mpl_round(x); y = mpl_round(y); + if (face.first) { rendererAA.color(face.second); sa.init(fillCache, fillSize, x, y); @@ -1179,7 +1183,7 @@ PathListGenerator path_generator(paths); try { - _draw_path_collection_generic<PathListGenerator, 1, 1> + _draw_path_collection_generic<PathListGenerator, 0, 1> (master_transform, cliprect, clippath, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-01-16 18:45:43
|
Revision: 6794 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6794&view=rev Author: mdboom Date: 2009-01-16 18:45:39 +0000 (Fri, 16 Jan 2009) Log Message: ----------- Use miter_join_revert in Agg backend to match behavior of other backends. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009-01-16 18:45:18 UTC (rev 6793) +++ trunk/matplotlib/src/_backend_agg.cpp 2009-01-16 18:45:39 UTC (rev 6794) @@ -209,7 +209,7 @@ std::string joinstyle = Py::String( gc.getAttr("_joinstyle") ); if (joinstyle=="miter") - join = agg::miter_join; + join = agg::miter_join_revert; else if (joinstyle=="round") join = agg::round_join; else if(joinstyle=="bevel") This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-06-08 12:57:25
|
Revision: 7200 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7200&view=rev Author: mdboom Date: 2009-06-08 12:57:17 +0000 (Mon, 08 Jun 2009) Log Message: ----------- Improve alignment of markers. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009-06-08 12:49:37 UTC (rev 7199) +++ trunk/matplotlib/src/_backend_agg.cpp 2009-06-08 12:57:17 UTC (rev 7200) @@ -598,8 +598,12 @@ if (has_clippath) { while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) { - x = mpl_round(x); y = mpl_round(y); + if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) { + continue; + } + x = (double)(int)x; y = (double)(int)y; + pixfmt_amask_type pfa(pixFmt, alphaMask); amask_ren_type r(pfa); amask_aa_renderer_type ren(r); @@ -615,8 +619,12 @@ } } else { while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) { - x = mpl_round(x); y = mpl_round(y); + if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) { + continue; + } + x = (double)(int)x; y = (double)(int)y; + if (face.first) { rendererAA.color(face.second); sa.init(fillCache, fillSize, x, y); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lee...@us...> - 2009-06-24 05:53:01
|
Revision: 7235 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7235&view=rev Author: leejjoon Date: 2009-06-24 05:51:52 +0000 (Wed, 24 Jun 2009) Log Message: ----------- backend_agg.draw_marker quantizes the main path (checking in a missed file) Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009-06-24 05:49:37 UTC (rev 7234) +++ trunk/matplotlib/src/_backend_agg.cpp 2009-06-24 05:51:52 UTC (rev 7235) @@ -542,13 +542,17 @@ PathIterator marker_path(marker_path_obj); transformed_path_t marker_path_transformed(marker_path, marker_trans); quantize_t marker_path_quantized(marker_path_transformed, - gc.quantize_mode, + gc.quantize_mode, marker_path.total_vertices()); curve_t marker_path_curve(marker_path_quantized); PathIterator path(path_obj); transformed_path_t path_transformed(path, trans); - path_transformed.rewind(0); + quantize_t path_quantized(path_transformed, + gc.quantize_mode, + path.total_vertices()); + curve_t path_curve(path_quantized); + path_curve.rewind(0); facepair_t face = _get_rgba_face(face_obj, gc.alpha); @@ -597,7 +601,7 @@ agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl; if (has_clippath) { - while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) { + while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) { if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) { continue; } @@ -618,7 +622,7 @@ agg::render_scanlines(sa, sl, ren); } } else { - while (path_transformed.vertex(&x, &y) != agg::path_cmd_stop) { + while (path_curve.vertex(&x, &y) != agg::path_cmd_stop) { if (MPL_notisfinite64(x) || MPL_notisfinite64(y)) { continue; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-08-07 19:39:34
|
Revision: 7420 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7420&view=rev Author: mdboom Date: 2009-08-07 19:39:27 +0000 (Fri, 07 Aug 2009) Log Message: ----------- Fix segfault in Agg backend Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009-08-07 18:33:02 UTC (rev 7419) +++ trunk/matplotlib/src/_backend_agg.cpp 2009-08-07 19:39:27 UTC (rev 7420) @@ -1270,9 +1270,11 @@ _VERBOSE("RendererAgg::draw_path_collection"); args.verify_length(12); - GCAgg gc(args[0], dpi); + Py::Object gc_obj = args[0]; + GCAgg gc(gc_obj, dpi); agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[1].ptr()); - PathListGenerator paths(args[2]); + Py::SeqBase<Py::Object> path = args[2]; + PathListGenerator path_generator(path); Py::SeqBase<Py::Object> transforms_obj = args[3]; Py::Object offsets_obj = args[4]; agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[5].ptr()); @@ -1283,7 +1285,6 @@ Py::SeqBase<Py::Int> antialiaseds = args[10]; // We don't actually care about urls for Agg, so just ignore it. // Py::SeqBase<Py::Object> urls = args[11]; - PathListGenerator path_generator(paths); try { _draw_path_collection_generic<PathListGenerator, 0, 1> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2009-09-02 19:30:44
|
Revision: 7628 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=7628&view=rev Author: mdboom Date: 2009-09-02 19:30:30 +0000 (Wed, 02 Sep 2009) Log Message: ----------- Improve memory management and error handling in draw_gouraud_triangle(s) in the Agg backend. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2009-09-02 00:44:16 UTC (rev 7627) +++ trunk/matplotlib/src/_backend_agg.cpp 2009-09-02 19:30:30 UTC (rev 7628) @@ -1094,14 +1094,14 @@ throw Py::ValueError("Offsets array must be Nx2"); } - PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject + facecolors = (PyArrayObject*)PyArray_FromObject (facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); if (!facecolors || (PyArray_NDIM(facecolors) == 1 && PyArray_DIM(facecolors, 0) != 0) || (PyArray_NDIM(facecolors) == 2 && PyArray_DIM(facecolors, 1) != 4)) throw Py::ValueError("Facecolors must be a Nx4 numpy array or empty"); - PyArrayObject* edgecolors = (PyArrayObject*)PyArray_FromObject + edgecolors = (PyArrayObject*)PyArray_FromObject (edgecolors_obj.ptr(), PyArray_DOUBLE, 1, 2); if (!edgecolors || (PyArray_NDIM(edgecolors) == 1 && PyArray_DIM(edgecolors, 0) != 0) || @@ -1459,13 +1459,14 @@ RendererAgg::_draw_gouraud_triangle(const GCAgg& gc, const double* points, const double* colors, agg::trans_affine trans) { - typedef agg::rgba8 color_t; - typedef agg::span_gouraud_rgba<color_t> span_gen_t; - typedef agg::span_allocator<color_t> span_alloc_t; + typedef agg::rgba8 color_t; + typedef agg::span_gouraud_rgba<color_t> span_gen_t; + typedef agg::span_allocator<color_t> span_alloc_t; theRasterizer.reset_clipping(); rendererBase.reset_clipping(true); set_clipbox(gc.cliprect, theRasterizer); + /* TODO: Support clip paths */ trans *= agg::trans_affine_scaling(1.0, -1.0); trans *= agg::trans_affine_translation(0.0, (double)height); @@ -1492,8 +1493,8 @@ 0.5); theRasterizer.add_path(span_gen); - agg::render_scanlines_aa( - theRasterizer, slineP8, rendererBase, span_alloc, span_gen); + + agg::render_scanlines_aa(theRasterizer, slineP8, rendererBase, span_alloc, span_gen); } Py::Object @@ -1501,36 +1502,40 @@ _VERBOSE("RendererAgg::draw_gouraud_triangle"); args.verify_length(4); - //segments, trans, clipbox, colors, linewidths, antialiaseds GCAgg gc(args[0], dpi); Py::Object points_obj = args[1]; Py::Object colors_obj = args[2]; agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr()); - PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny - (points_obj.ptr(), PyArray_DOUBLE, 2, 2); - if (!points || - PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2) - throw Py::ValueError("points must be a 3x2 numpy array"); + PyArrayObject* points = NULL; + PyArrayObject* colors = NULL; - PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny - (colors_obj.ptr(), PyArray_DOUBLE, 2, 2); - if (!colors || - PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4) - throw Py::ValueError("colors must be a 3x4 numpy array"); + try { + points = (PyArrayObject*)PyArray_ContiguousFromAny + (points_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!points || + PyArray_DIM(points, 0) != 3 || PyArray_DIM(points, 1) != 2) { + throw Py::ValueError("points must be a 3x2 numpy array"); + } - try { + colors = (PyArrayObject*)PyArray_ContiguousFromAny + (colors_obj.ptr(), PyArray_DOUBLE, 2, 2); + if (!colors || + PyArray_DIM(colors, 0) != 3 || PyArray_DIM(colors, 1) != 4) { + throw Py::ValueError("colors must be a 3x4 numpy array"); + } + _draw_gouraud_triangle( gc, (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors), trans); } catch (...) { - Py_DECREF(points); - Py_DECREF(colors); + Py_XDECREF(points); + Py_XDECREF(colors); throw; } - Py_DECREF(points); - Py_DECREF(colors); + Py_XDECREF(points); + Py_XDECREF(colors); return Py::Object(); } @@ -1544,42 +1549,45 @@ typedef agg::span_gouraud_rgba<color_t> span_gen_t; typedef agg::span_allocator<color_t> span_alloc_t; - //segments, trans, clipbox, colors, linewidths, antialiaseds GCAgg gc(args[0], dpi); Py::Object points_obj = args[1]; Py::Object colors_obj = args[2]; agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr()); - PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny - (points_obj.ptr(), PyArray_DOUBLE, 3, 3); - if (!points || - PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2) - throw Py::ValueError("points must be a Nx3x2 numpy array"); + PyArrayObject* points = NULL; + PyArrayObject* colors = NULL; - PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny - (colors_obj.ptr(), PyArray_DOUBLE, 3, 3); - if (!colors || - PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4) - throw Py::ValueError("colors must be a Nx3x4 numpy array"); + try { + points = (PyArrayObject*)PyArray_ContiguousFromAny + (points_obj.ptr(), PyArray_DOUBLE, 3, 3); + if (!points || + PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2) { + throw Py::ValueError("points must be a Nx3x2 numpy array"); + } - if (PyArray_DIM(points, 0) != PyArray_DIM(colors, 0)) { - throw Py::ValueError("points and colors arrays must be the same length"); - } + colors = (PyArrayObject*)PyArray_ContiguousFromAny + (colors_obj.ptr(), PyArray_DOUBLE, 3, 3); + if (!colors || + PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4) { + throw Py::ValueError("colors must be a Nx3x4 numpy array"); + } - try { + if (PyArray_DIM(points, 0) != PyArray_DIM(colors, 0)) { + throw Py::ValueError("points and colors arrays must be the same length"); + } + 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(gc, (double*)PyArray_GETPTR1(points, i), (double*)PyArray_GETPTR1(colors, i), trans); } } catch (...) { - Py_DECREF(points); - Py_DECREF(colors); + Py_XDECREF(points); + Py_XDECREF(colors); throw; } - Py_DECREF(points); - Py_DECREF(colors); + Py_XDECREF(points); + Py_XDECREF(colors); return Py::Object(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-05-12 15:28:19
|
Revision: 8314 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8314&view=rev Author: mdboom Date: 2010-05-12 15:28:12 +0000 (Wed, 12 May 2010) Log Message: ----------- Suppress compiler warning. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2010-05-12 15:27:53 UTC (rev 8313) +++ trunk/matplotlib/src/_backend_agg.cpp 2010-05-12 15:28:12 UTC (rev 8314) @@ -834,6 +834,8 @@ } else { x = mpl_round(Py::Float(args[1])); y = mpl_round(Py::Float(args[2])); + w = h = 0; /* w and h not used in this case, but assign to prevent + warnings from the compiler */ } @@ -890,7 +892,7 @@ typedef agg::pixfmt_amask_adaptor<pixfmt, alpha_mask_type> pixfmt_amask_type; typedef agg::renderer_base<pixfmt_amask_type> amask_ren_type; typedef agg::renderer_scanline_aa<amask_ren_type, color_span_alloc_type, image_span_gen_type> renderer_type_alpha; - + pixfmt_amask_type pfa(pixFmt, alphaMask); amask_ren_type r(pfa); renderer_type_alpha ri(r, sa, image_span_generator); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-06-24 17:12:32
|
Revision: 8463 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8463&view=rev Author: mdboom Date: 2010-06-24 17:12:26 +0000 (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. |
From: <md...@us...> - 2010-07-06 15:18:49
|
Revision: 8515 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8515&view=rev Author: mdboom Date: 2010-07-06 15:18:43 +0000 (Tue, 06 Jul 2010) Log Message: ----------- Reset clipping upon exit of draw_markers to avoid negative interaction with blitting. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2010-07-06 14:48:31 UTC (rev 8514) +++ trunk/matplotlib/src/_backend_agg.cpp 2010-07-06 15:18:43 UTC (rev 8515) @@ -796,6 +796,8 @@ delete[] fillCache; if (strokeCache != staticStrokeCache) delete[] strokeCache; + theRasterizer.reset_clipping(); + rendererBase.reset_clipping(true); throw; } @@ -804,6 +806,9 @@ if (strokeCache != staticStrokeCache) delete[] strokeCache; + theRasterizer.reset_clipping(); + rendererBase.reset_clipping(true); + return Py::Object(); } @@ -1086,6 +1091,7 @@ { set_clipbox(gc.cliprect, rendererBase); rendererBase.blend_from(pixf, 0, (int)x, (int)(height - (y + image->rowsOut))); + rendererBase.reset_clipping(true); } image->flipud_out(empty); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <md...@us...> - 2010-10-04 19:22:38
|
Revision: 8728 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8728&view=rev Author: mdboom Date: 2010-10-04 19:22:32 +0000 (Mon, 04 Oct 2010) Log Message: ----------- Speed up Gouraud triangles in Agg backend. Modified Paths: -------------- trunk/matplotlib/src/_backend_agg.cpp Modified: trunk/matplotlib/src/_backend_agg.cpp =================================================================== --- trunk/matplotlib/src/_backend_agg.cpp 2010-10-04 18:46:18 UTC (rev 8727) +++ trunk/matplotlib/src/_backend_agg.cpp 2010-10-04 19:22:32 UTC (rev 8728) @@ -1910,13 +1910,15 @@ Py::Object points_obj = args[1]; Py::Object colors_obj = args[2]; agg::trans_affine trans = py_to_agg_transformation_matrix(args[3].ptr()); + double c_points[6]; + double c_colors[12]; theRasterizer.reset_clipping(); rendererBase.reset_clipping(true); set_clipbox(gc.cliprect, theRasterizer); bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans); - PyArrayObject* points = (PyArrayObject*)PyArray_ContiguousFromAny + PyArrayObject* points = (PyArrayObject*)PyArray_FromObject (points_obj.ptr(), PyArray_DOUBLE, 3, 3); if (!points || PyArray_DIM(points, 1) != 3 || PyArray_DIM(points, 2) != 2) @@ -1926,7 +1928,7 @@ } points_obj = Py::Object((PyObject*)points, true); - PyArrayObject* colors = (PyArrayObject*)PyArray_ContiguousFromAny + PyArrayObject* colors = (PyArrayObject*)PyArray_FromObject (colors_obj.ptr(), PyArray_DOUBLE, 3, 3); if (!colors || PyArray_DIM(colors, 1) != 3 || PyArray_DIM(colors, 2) != 4) @@ -1943,9 +1945,20 @@ for (int i = 0; i < PyArray_DIM(points, 0); ++i) { + for (int j = 0; j < 3; ++j) { + for (int k = 0; k < 2; ++k) { + c_points[j*2+k] = *(double *)PyArray_GETPTR3(points, i, j, k); + } + } + + for (int j = 0; j < 3; ++j) { + for (int k = 0; k < 4; ++k) { + c_colors[j*4+k] = *(double *)PyArray_GETPTR3(colors, i, j, k); + } + } + _draw_gouraud_triangle( - (double*)PyArray_GETPTR1(points, i), - (double*)PyArray_GETPTR1(colors, i), trans, has_clippath); + c_points, c_colors, trans, has_clippath); } return Py::Object(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |