SourceForge logo
SourceForge logo
Menu

matplotlib-checkins

From: <md...@us...> - 2007年09月20日 14:26:32
Revision: 3868
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3868&view=rev
Author: mdboom
Date: 2007年09月20日 07:26:27 -0700 (2007年9月20日)
Log Message:
-----------
Don't copy path array to a contiguous one.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年09月20日 14:13:51 UTC (rev 3867)
+++ branches/transforms/src/_backend_agg.cpp	2007年09月20日 14:26:27 UTC (rev 3868)
@@ -100,17 +100,18 @@
 Py::Object vertices_obj = path_obj.getAttr("vertices");
 Py::Object codes_obj = path_obj.getAttr("codes");
 
- vertices = (PyArrayObject*)PyArray_ContiguousFromObject
+ vertices = (PyArrayObject*)PyArray_FromObject
 (vertices_obj.ptr(), PyArray_DOUBLE, 2, 2);
 if (!vertices || vertices->nd != 2 || vertices->dimensions[1] != 2)
 throw Py::ValueError("Invalid vertices array.");
- codes = (PyArrayObject*)PyArray_ContiguousFromObject
+
+ codes = (PyArrayObject*)PyArray_FromObject
 (codes_obj.ptr(), PyArray_UINT8, 1, 1);
 if (!codes) 
 throw Py::ValueError("Invalid codes array.");
 
 if (codes->dimensions[0] != vertices->dimensions[0])
- throw Py::ValueError("Vertices and codes array are not the same length.");
+ throw Py::ValueError("vertices and codes arrays are not the same length.");
 
 m_total_vertices = codes->dimensions[0];
 }
@@ -125,10 +126,9 @@
 inline unsigned vertex(unsigned idx, double* x, double* y) {
 if (idx > m_total_vertices)
 throw Py::RuntimeError("Requested vertex past end");
- double* pv = (double*)(vertices->data + (idx * vertices->strides[0]));
- *x = *pv++;
- *y = *pv;
- return code_map[(unsigned int)*(codes->data + (idx * codes->strides[0]))];
+ *x = *(double*)PyArray_GETPTR2(vertices, idx, 0);
+ *y = *(double*)PyArray_GETPTR2(vertices, idx, 1);
+ return code_map[(int)*(char *)PyArray_GETPTR1(codes, idx)];
 }
 
 inline unsigned vertex(double* x, double* y) {
@@ -145,12 +145,14 @@
 }
 };
 
-const char PathIterator::code_map[] = {0, 
-				 agg::path_cmd_move_to, 
-				 agg::path_cmd_line_to, 
-				 agg::path_cmd_curve3,
-				 agg::path_cmd_curve4,
-				 agg::path_cmd_end_poly | agg::path_flags_close};
+// Maps path codes on the Python side to agg path commands
+const char PathIterator::code_map[] = 
+ {0, 
+ agg::path_cmd_move_to, 
+ agg::path_cmd_line_to, 
+ agg::path_cmd_curve3,
+ agg::path_cmd_curve4,
+ agg::path_cmd_end_poly | agg::path_flags_close};
 
 template<class VertexSource> class conv_quantize
 {
@@ -160,19 +162,16 @@
 
 void set_source(VertexSource& source) { m_source = &source; }
 
- void rewind(unsigned path_id) 
- { 
+ void rewind(unsigned path_id) { 
 m_source->rewind(path_id); 
 }
 
- unsigned vertex(double* x, double* y)
- {
+ unsigned vertex(double* x, double* y) {
 unsigned cmd = m_source->vertex(x, y);
- if(m_quantize && agg::is_vertex(cmd))
- {
-	*x = (int)(*x);
-	*y = (int)(*y);
- }
+ if (m_quantize && agg::is_vertex(cmd)) {
+ *x = (int)(*x + 0.5);
+ *y = (int)(*y + 0.5);
+ }
 return cmd;
 }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年10月23日 16:54:56
Revision: 3986
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3986&view=rev
Author: mdboom
Date: 2007年10月23日 09:54:51 -0700 (2007年10月23日)
Log Message:
-----------
Fix bug that broke draw_image
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年10月23日 16:40:25 UTC (rev 3985)
+++ branches/transforms/src/_backend_agg.cpp	2007年10月23日 16:54:51 UTC (rev 3986)
@@ -48,17 +48,11 @@
 PyArrayObject* matrix = NULL;
 
 try {
- if (obj.ptr() == Py_None) {
- if (errors)
-	throw Py::Exception();
- return agg::trans_affine();
- }
+ if (obj.ptr() == Py_None)
+ throw Py::Exception();
 matrix = (PyArrayObject*) PyArray_FromObject(obj.ptr(), PyArray_DOUBLE, 2, 2);
- if (!matrix) {
- if (errors)
-	throw Py::Exception();
- return agg::trans_affine();
- }
+ if (!matrix)
+ throw Py::Exception();
 if (matrix->nd == 2 || matrix->dimensions[0] == 3 || matrix->dimensions[1] == 3) {
 size_t stride0 = matrix->strides[0];
 size_t stride1 = matrix->strides[1];
@@ -81,16 +75,16 @@
 
 return agg::trans_affine(a, b, c, d, e, f);
 }
+
+ throw Py::Exception();
 } catch (...) {
 if (errors) {
 Py_XDECREF(matrix);
- throw;
+ throw Py::TypeError("Invalid affine transformation matrix");
 }
 }
 
 Py_XDECREF(matrix);
- if (errors)
- throw Py::TypeError("Invalid affine transformation matrix");
 return agg::trans_affine();
 }
 
@@ -797,6 +791,7 @@
 Py::Object
 RendererAgg::draw_image(const Py::Tuple& args) {
 _VERBOSE("RendererAgg::draw_image");
+
 args.verify_length(4, 6);
 
 float x = Py::Float(args[0]);
@@ -807,7 +802,7 @@
 agg::trans_affine clippath_trans;
 if (args.size() == 6) {
 clippath = args[4];
- clippath_trans = py_to_agg_transformation_matrix(args[5]);
+ clippath_trans = py_to_agg_transformation_matrix(args[5], false);
 }
 
 theRasterizer->reset_clipping();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年10月23日 19:20:27
Revision: 3988
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3988&view=rev
Author: mdboom
Date: 2007年10月23日 12:20:21 -0700 (2007年10月23日)
Log Message:
-----------
Reduce tendency to use aliased drawing.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年10月23日 19:16:11 UTC (rev 3987)
+++ branches/transforms/src/_backend_agg.cpp	2007年10月23日 19:20:21 UTC (rev 3988)
@@ -434,7 +434,7 @@
 }
 
 trans.transform(&x1, &y1);
- if (!(fabs(x0 - x1) < 0.1 || fabs(y0 - y1) < 0.1)) {
+ if (!(fabs(x0 - x1) < 0.001 || fabs(y0 - y1) < 0.001)) {
 path.rewind(0);
 return false;
 }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年10月23日 19:48:30
Revision: 3990
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=3990&view=rev
Author: mdboom
Date: 2007年10月23日 12:48:14 -0700 (2007年10月23日)
Log Message:
-----------
Fix bug affecting legend_auto.py
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年10月23日 19:47:43 UTC (rev 3989)
+++ branches/transforms/src/_backend_agg.cpp	2007年10月23日 19:48:14 UTC (rev 3990)
@@ -1568,12 +1568,12 @@
 curved_path.rewind(0);
 
 while ((code = curved_path.vertex(&x, &y)) != agg::path_cmd_stop) {
+ if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
+ continue;
 if (x < *x0) *x0 = x;
 if (y < *y0) *y0 = y;
 if (x > *x1) *x1 = x;
 if (y > *y1) *y1 = y;
- if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
- continue;
 }
 }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年11月09日 16:34:08
Revision: 4184
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4184&view=rev
Author: mdboom
Date: 2007年11月09日 08:33:58 -0800 (2007年11月09日)
Log Message:
-----------
Fix misaligned clipping rectangle.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年11月09日 14:24:41 UTC (rev 4183)
+++ branches/transforms/src/_backend_agg.cpp	2007年11月09日 16:33:58 UTC (rev 4184)
@@ -282,7 +282,7 @@
 
 double l, b, r, t;
 if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) {
- rasterizer->clip_box((int)l, (int)b, (int)r, (int)t);
+ rasterizer->clip_box((int)l + 1, (int)b + 1, (int)r + 1, (int)t + 1);
 }
 
 _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...> - 2007年11月14日 18:38:58
Revision: 4283
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4283&view=rev
Author: mdboom
Date: 2007年11月14日 10:38:05 -0800 (2007年11月14日)
Log Message:
-----------
Fix alignment of clipping rectangles.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年11月14日 18:36:45 UTC (rev 4282)
+++ branches/transforms/src/_backend_agg.cpp	2007年11月14日 18:38:05 UTC (rev 4283)
@@ -282,7 +282,8 @@
 
 double l, b, r, t;
 if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) {
- rasterizer->clip_box((int)l + 1, height - (int)(b + 1), (int)r + 1, height - (int)(t + 1));
+ rasterizer->clip_box(int(round(l)) + 1, height - int(round(b)) + 1, 
+			 int(round(r)) + 1, height - int(round(t)) + 1);
 }
 
 _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...> - 2007年11月20日 13:50:12
Revision: 4392
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4392&view=rev
Author: mdboom
Date: 2007年11月20日 05:50:04 -0800 (2007年11月20日)
Log Message:
-----------
Removing trailing whitespace so a merge from trunk will be possible.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年11月20日 13:29:20 UTC (rev 4391)
+++ branches/transforms/src/_backend_agg.cpp	2007年11月20日 13:50:04 UTC (rev 4392)
@@ -50,7 +50,7 @@
 the C++ representation as a std::vector<std::pair<double, double> >
 (GCAgg::dash_t)
 */
-void convert_dashes(const Py::Tuple& dashes, double dpi, GCAgg::dash_t& dashes_out, 
+void convert_dashes(const Py::Tuple& dashes, double dpi, GCAgg::dash_t& dashes_out,
 		 double& dashOffset_out) {
 if (dashes.length()!=2)
 throw Py::ValueError(Printf("Dash descriptor must be a length 2 tuple; found %d", dashes.length()).str());
@@ -59,11 +59,11 @@
 dashOffset_out = 0.0;
 if (dashes[0].ptr() == Py_None)
 return;
- 
+
 dashOffset_out = double(Py::Float(dashes[0])) * dpi/72.0;
 
 Py::SeqBase<Py::Object> dashSeq = dashes[1];
- 
+
 size_t Ndash = dashSeq.length();
 if (Ndash % 2 != 0)
 throw Py::ValueError(Printf("Dash sequence must be an even length sequence; found %d", Ndash).str());
@@ -89,9 +89,9 @@
 public:
 conv_quantize(VertexSource& source, bool quantize) :
 m_source(&source), m_quantize(quantize) {}
- 
- void rewind(unsigned path_id) { 
- m_source->rewind(path_id); 
+
+ void rewind(unsigned path_id) {
+ m_source->rewind(path_id);
 }
 
 unsigned vertex(double* x, double* y) {
@@ -142,9 +142,9 @@
 GCAgg::get_color(const Py::Object& gc) {
 _VERBOSE("GCAgg::get_color");
 Py::Tuple rgb = Py::Tuple( gc.getAttr("_rgb") );
- 
+
 double alpha = Py::Float( gc.getAttr("_alpha") );
- 
+
 double r = Py::Float(rgb[0]);
 double g = Py::Float(rgb[1]);
 double b = Py::Float(rgb[2]);
@@ -161,7 +161,7 @@
 void
 GCAgg::_set_linecap(const Py::Object& gc) {
 _VERBOSE("GCAgg::_set_linecap");
- 
+
 std::string capstyle = Py::String( gc.getAttr( "_capstyle" ) );
 
 if (capstyle=="butt")
@@ -177,9 +177,9 @@
 void
 GCAgg::_set_joinstyle(const Py::Object& gc) {
 _VERBOSE("GCAgg::_set_joinstyle");
- 
+
 std::string joinstyle = Py::String( gc.getAttr("_joinstyle") );
- 
+
 if (joinstyle=="miter")
 join = agg::miter_join;
 else if (joinstyle=="round")
@@ -194,7 +194,7 @@
 GCAgg::_set_dashes(const Py::Object& gc) {
 //return the dashOffset, dashes sequence tuple.
 _VERBOSE("GCAgg::_set_dashes");
- 
+
 Py::Object dash_obj( gc.getAttr( "_dashes" ) );
 if (dash_obj.ptr() == Py_None) {
 dashes.clear();
@@ -207,7 +207,7 @@
 void
 GCAgg::_set_clip_rectangle( const Py::Object& gc) {
 //set the clip rectangle from the gc
- 
+
 _VERBOSE("GCAgg::_set_clip_rectangle");
 
 Py::Object o ( gc.getAttr( "_cliprect" ) );
@@ -217,9 +217,9 @@
 void
 GCAgg::_set_clip_path( const Py::Object& gc) {
 //set the clip path from the gc
- 
+
 _VERBOSE("GCAgg::_set_clip_path");
- 
+
 Py::Object method_obj = gc.getAttr("get_clip_path");
 Py::Callable method(method_obj);
 Py::Tuple path_and_transform = method.apply(Py::Tuple());
@@ -243,12 +243,12 @@
 {
 _VERBOSE("RendererAgg::RendererAgg");
 unsigned stride(width*4);
- 
- 
+
+
 pixBuffer	 = new agg::int8u[NUMBYTES];
 renderingBuffer = new agg::rendering_buffer;
 renderingBuffer->attach(pixBuffer, width, height, stride);
- 
+
 alphaBuffer		 = new agg::int8u[NUMBYTES];
 alphaMaskRenderingBuffer = new agg::rendering_buffer;
 alphaMaskRenderingBuffer->attach(alphaBuffer, width, height, stride);
@@ -258,33 +258,33 @@
 rendererBaseAlphaMask	 = new renderer_base_alpha_mask_type(*pixfmtAlphaMask);
 rendererAlphaMask	 = new renderer_alpha_mask_type(*rendererBaseAlphaMask);
 scanlineAlphaMask	 = new agg::scanline_p8();
- 
- 
+
+
 slineP8 = new scanline_p8;
 slineBin = new scanline_bin;
- 
+
 pixFmt = new pixfmt(*renderingBuffer);
 rendererBase = new renderer_base(*pixFmt);
 rendererBase->clear(agg::rgba(1, 1, 1, 0));
- 
+
 rendererAA	= new renderer_aa(*rendererBase);
 rendererBin	= new renderer_bin(*rendererBase);
 theRasterizer = new rasterizer();
 //theRasterizer->filling_rule(agg::fill_even_odd);
 //theRasterizer->filling_rule(agg::fill_non_zero);
- 
+
 };
 
 template<class R>
 void
 RendererAgg::set_clipbox(const Py::Object& cliprect, R rasterizer) {
 //set the clip rectangle from the gc
- 
+
 _VERBOSE("RendererAgg::set_clipbox");
 
 double l, b, r, t;
 if (py_convert_bbox(cliprect.ptr(), l, b, r, t)) {
- rasterizer->clip_box(int(round(l)) + 1, height - int(round(b)), 
+ rasterizer->clip_box(int(round(l)) + 1, height - int(round(b)),
 			 int(round(r)), height - int(round(t)));
 }
 
@@ -295,7 +295,7 @@
 RendererAgg::_get_rgba_face(const Py::Object& rgbFace, double alpha) {
 _VERBOSE("RendererAgg::_get_rgba_face");
 std::pair<bool, agg::rgba> face;
- 
+
 if (rgbFace.ptr() == Py_None) {
 face.first = false;
 }
@@ -311,7 +311,7 @@
 SafeSnap::snap (const float& x, const float& y) {
 xsnap = (int)x + 0.5;
 ysnap = (int)y + 0.5;
- 
+
 if ( first || ( (xsnap!=lastxsnap) || (ysnap!=lastysnap) ) ) {
 lastxsnap = xsnap;
 lastysnap = ysnap;
@@ -328,7 +328,7 @@
 lastysnap = ysnap;
 lastx = x;
 lasty = y;
- return SnapData(false, xsnap, ysnap); 
+ return SnapData(false, xsnap, ysnap);
 }
 
 // ok the real points are not identical but the rounded ones, so do
@@ -343,12 +343,12 @@
 lastysnap = ysnap;
 lastx = x;
 lasty = y;
- return SnapData(true, xsnap, ysnap); 
-} 
+ return SnapData(true, xsnap, ysnap);
+}
 
 template<class Path>
 bool should_snap(Path& path, const agg::trans_affine& trans) {
- // If this is a straight horizontal or vertical line, quantize to nearest 
+ // If this is a straight horizontal or vertical line, quantize to nearest
 // pixels
 double x0, y0, x1, y1;
 unsigned code;
@@ -385,11 +385,11 @@
 
 Py::Object box_obj = args[0];
 double l, b, r, t;
- if (!py_convert_bbox(box_obj.ptr(), l, b, r, t)) 
+ if (!py_convert_bbox(box_obj.ptr(), l, b, r, t))
 throw Py::TypeError("Invalid bbox provided to copy_from_bbox");
- 
+
 agg::rect_i rect((int)l, height - (int)t, (int)r, height - (int)b);
- 
+
 BufferRegion* reg = NULL;
 try {
 reg = new BufferRegion(rect, true);
@@ -403,7 +403,7 @@
 
 agg::rendering_buffer rbuf;
 rbuf.attach(reg->data, reg->width, reg->height, reg->stride);
- 
+
 pixfmt pf(rbuf);
 renderer_base rb(pf);
 rb.copy_from(*renderingBuffer, &rect, -rect.x1, -rect.y1);
@@ -415,20 +415,20 @@
 //copy BufferRegion to buffer
 args.verify_length(1);
 BufferRegion* region = static_cast<BufferRegion*>(args[0].ptr());
- 
+
 if (region->data==NULL)
 return Py::Object();
 //throw Py::ValueError("Cannot restore_region from NULL data");
- 
- 
+
+
 agg::rendering_buffer rbuf;
 rbuf.attach(region->data,
 	 region->width,
 	 region->height,
 	 region->stride);
- 
+
 rendererBase->copy_from(rbuf, 0, region->rect.x1, region->rect.y1);
- 
+
 return Py::Object();
 }
 
@@ -438,8 +438,8 @@
 
 bool has_clippath = (clippath.ptr() != Py_None);
 
- if (has_clippath && 
- (clippath.ptr() != lastclippath.ptr() || 
+ if (has_clippath &&
+ (clippath.ptr() != lastclippath.ptr() ||
 clippath_trans != lastclippath_transform)) {
 agg::trans_affine trans(clippath_trans);
 trans *= agg::trans_affine_scaling(1.0, -1.0);
@@ -471,7 +471,7 @@
 typedef agg::renderer_scanline_bin_solid<amask_ren_type> amask_bin_renderer_type;
 
 args.verify_length(5, 6);
- 
+
 Py::Object	 gc_obj	 = args[0];
 Py::Object	 marker_path_obj = args[1];
 agg::trans_affine marker_trans = py_to_agg_transformation_matrix(args[2]);
@@ -485,7 +485,7 @@
 marker_trans *= agg::trans_affine_scaling(1.0, -1.0);
 trans *= agg::trans_affine_scaling(1.0, -1.0);
 trans *= agg::trans_affine_translation(0.0, (double)height);
- 
+
 PathIterator marker_path(marker_path_obj);
 transformed_path_t marker_path_transformed(marker_path, marker_trans);
 curve_t marker_path_curve(marker_path_transformed);
@@ -498,11 +498,11 @@
 path_quantized.rewind(0);
 
 facepair_t face = _get_rgba_face(face_obj, gc.alpha);
- 
+
 //maxim's suggestions for cached scanlines
 agg::scanline_storage_aa8 scanlines;
 theRasterizer->reset();
- 
+
 agg::int8u* fillCache = NULL;
 agg::int8u* strokeCache = NULL;
 
@@ -515,7 +515,7 @@
 fillCache = new agg::int8u[fillSize]; // or any container
 scanlines.serialize(fillCache);
 }
- 
+
 stroke_t stroke(marker_path_curve);
 stroke.width(gc.linewidth);
 stroke.line_cap(gc.cap);
@@ -531,7 +531,7 @@
 rendererBase->reset_clipping(true);
 set_clipbox(gc.cliprect, rendererBase);
 bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
- 
+
 double x, y;
 
 agg::serialized_scanlines_adaptor_aa8 sa;
@@ -580,16 +580,16 @@
 delete[] strokeCache;
 throw;
 }
- 
+
 delete [] fillCache;
 delete [] strokeCache;
 
 return Py::Object();
- 
+
 }
 
 /**
- * This is a custom span generator that converts spans in the 
+ * This is a custom span generator that converts spans in the
 * 8-bit inverted greyscale font buffer to rgba that agg can use.
 */
 template<class ChildGenerator>
@@ -605,9 +605,9 @@
 child_type* _gen;
 color_type _color;
 span_alloc_type _allocator;
- 
+
 public:
- font_to_rgba(child_type* gen, color_type color) : 
+ font_to_rgba(child_type* gen, color_type color) :
 _gen(gen),
 _color(color) {
 }
@@ -626,7 +626,7 @@
 } while (--len);
 }
 
- void prepare() 
+ void prepare()
 {
 _gen->prepare();
 }
@@ -642,18 +642,18 @@
 typedef agg::span_allocator<agg::rgba8> color_span_alloc_type;
 typedef agg::span_interpolator_linear<> interpolator_type;
 typedef agg::image_accessor_clip<agg::pixfmt_gray8> image_accessor_type;
- typedef agg::span_image_filter_gray_2x2<image_accessor_type, interpolator_type> 
+ typedef agg::span_image_filter_gray_2x2<image_accessor_type, interpolator_type>
 image_span_gen_type;
 typedef font_to_rgba<image_span_gen_type> span_gen_type;
- typedef agg::renderer_scanline_aa<renderer_base, color_span_alloc_type, span_gen_type> 
+ typedef agg::renderer_scanline_aa<renderer_base, color_span_alloc_type, span_gen_type>
 renderer_type;
- 
+
 args.verify_length(5);
- 
+
 FT2Image *image = static_cast<FT2Image*>(args[0].ptr());
 if (!image->get_buffer())
 return Py::Object();
- 
+
 int x(0),y(0);
 try {
 x = Py::Int( args[1] );
@@ -663,21 +663,21 @@
 //x,y out of range; todo issue warning?
 return Py::Object();
 }
- 
+
 double angle = Py::Float( args[3] );
 
 GCAgg gc = GCAgg(args[4], dpi);
- 
+
 theRasterizer->reset_clipping();
 rendererBase->reset_clipping(true);
 set_clipbox(gc.cliprect, theRasterizer);
 
 const unsigned char* const buffer = image->get_buffer();
 agg::rendering_buffer srcbuf
- ((agg::int8u*)buffer, image->get_width(), 
+ ((agg::int8u*)buffer, image->get_width(),
 image->get_height(), image->get_width());
 agg::pixfmt_gray8 pixf_img(srcbuf);
- 
+
 agg::trans_affine mtx;
 mtx *= agg::trans_affine_translation(0, -(int)image->get_height());
 mtx *= agg::trans_affine_rotation(-angle * agg::pi / 180.0);
@@ -702,10 +702,10 @@
 image_span_gen_type image_span_generator(ia, interpolator, filter);
 span_gen_type output_span_generator(&image_span_generator, gc.color);
 renderer_type ri(*rendererBase, sa, output_span_generator);
- 
+
 theRasterizer->add_path(rect2);
 agg::render_scanlines(*theRasterizer, *slineP8, ri);
- 
+
 return Py::Object();
 }
 
@@ -716,7 +716,7 @@
 _VERBOSE("RendererAgg::draw_image");
 
 args.verify_length(4, 6);
- 
+
 float x = Py::Float(args[0]);
 float y = Py::Float(args[1]);
 Image *image = static_cast<Image*>(args[2].ptr());
@@ -727,7 +727,7 @@
 clippath = args[4];
 clippath_trans = py_to_agg_transformation_matrix(args[5], false);
 }
- 
+
 theRasterizer->reset_clipping();
 rendererBase->reset_clipping(true);
 set_clipbox(box_obj, rendererBase);
@@ -739,13 +739,13 @@
 rendererBase->blend_from(pixf, 0, (int)x, (int)(height-(y+image->rowsOut)));
 
 image->flipud_out(empty);
- 
+
 return Py::Object();
 }
 
 template<class PathIteratorType>
-void RendererAgg::_draw_path(PathIteratorType& path, agg::trans_affine trans, 
-			 bool has_clippath, const facepair_t& face, 
+void RendererAgg::_draw_path(PathIteratorType& path, agg::trans_affine trans,
+			 bool has_clippath, const facepair_t& face,
 			 const GCAgg& gc, bool check_snap) {
 typedef agg::conv_transform<PathIteratorType>		 transformed_path_t;
 typedef conv_quantize<transformed_path_t>		 quantize_t;
@@ -768,7 +768,7 @@
 transformed_path_t tpath(path, trans);
 quantize_t quantized(tpath, snap);
 // Benchmarking shows that there is no noticable slowdown to always
- // treating paths as having curved segments. Doing so greatly 
+ // treating paths as having curved segments. Doing so greatly
 // simplifies the code
 curve_t curve(quantized);
 
@@ -824,14 +824,14 @@
 	 val1 = (int)val1 + 0.5;
 	}
 	dash.add_dash(val0, val1);
- } 
+ }
 stroke_dash_t stroke(dash);
 stroke.line_cap(gc.cap);
 stroke.line_join(gc.join);
 stroke.width(linewidth);
 theRasterizer->add_path(stroke);
 }
- 
+
 if (gc.isaa && !(snap)) {
 if (has_clippath) {
 	pixfmt_amask_type pfa(*pixFmt, *alphaMask);
@@ -856,7 +856,7 @@
 }
 }
 }
-}	 			 
+}
 
 Py::Object
 RendererAgg::draw_path(const Py::Tuple& args) {
@@ -873,14 +873,14 @@
 PathIterator path(path_obj);
 GCAgg gc = GCAgg(gc_obj, dpi);
 facepair_t face = _get_rgba_face(face_obj, gc.alpha);
- 
+
 theRasterizer->reset_clipping();
 rendererBase->reset_clipping(true);
 set_clipbox(gc.cliprect, theRasterizer);
 bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
 
 _draw_path(path, trans, has_clippath, face, gc, true);
- 
+
 return Py::Object();
 }
 
@@ -909,26 +909,26 @@
 
 try {
 offsets = (PyArrayObject*)PyArray_FromObject(offsets_obj.ptr(), PyArray_DOUBLE, 0, 2);
- if (!offsets || 
-	(PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) || 
+ if (!offsets ||
+	(PyArray_NDIM(offsets) == 2 && PyArray_DIM(offsets, 1) != 2) ||
 	(PyArray_NDIM(offsets) == 1 && PyArray_DIM(offsets, 0) != 0)) {
 throw Py::ValueError("Offsets array must be Nx2");
 }
 
 PyArrayObject* facecolors = (PyArrayObject*)PyArray_FromObject
 (facecolors_obj.ptr(), PyArray_DOUBLE, 1, 2);
- if (!facecolors || 
-	(PyArray_NDIM(facecolors) == 1 && PyArray_DIM(facecolors, 0) != 0) || 
+ 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_obj.ptr(), PyArray_DOUBLE, 1, 2);
- if (!edgecolors || 
-	(PyArray_NDIM(edgecolors) == 1 && PyArray_DIM(edgecolors, 0) != 0) || 
+ if (!edgecolors ||
+	(PyArray_NDIM(edgecolors) == 1 && PyArray_DIM(edgecolors, 0) != 0) ||
 	(PyArray_NDIM(edgecolors) == 2 && PyArray_DIM(edgecolors, 1) != 4))
 throw Py::ValueError("Edgecolors must be a Nx4 numpy array");
- 
+
 size_t Npaths = path_generator.num_paths();
 size_t Noffsets = offsets->dimensions[0];
 size_t N	 = std::max(Npaths, Noffsets);
@@ -941,9 +941,9 @@
 
 if ((Nfacecolors == 0 && Nedgecolors == 0) || Npaths == 0)
 return Py::Object();
- 
+
 size_t i = 0;
- 
+
 // Convert all of the transforms up front
 typedef std::vector<agg::trans_affine> transforms_t;
 transforms_t transforms;
@@ -954,23 +954,23 @@
 trans *= master_transform;
 transforms.push_back(trans);
 }
- 
+
 // Convert all the dashes up front
 typedef std::vector<std::pair<double, GCAgg::dash_t> > dashes_t;
 dashes_t dashes;
 dashes.resize(Nlinestyles);
 i = 0;
- for (dashes_t::iterator d = dashes.begin(); 
+ for (dashes_t::iterator d = dashes.begin();
 	 d != dashes.end(); ++d, ++i) {
 convert_dashes(Py::Tuple(linestyles_obj[i]), dpi, d->second, d->first);
 }
- 
+
 // Handle any clipping globally
 theRasterizer->reset_clipping();
 rendererBase->reset_clipping(true);
 set_clipbox(cliprect, theRasterizer);
 bool has_clippath = render_clippath(clippath, clippath_trans);
- 
+
 // Set some defaults, assuming no face or edge
 gc.linewidth = 0.0;
 facepair_t face;
@@ -991,7 +991,7 @@
 	offset_trans.transform(&xo, &yo);
 	trans *= agg::trans_affine_translation(xo, yo);
 }
- 
+
 if (Nfacecolors) {
 	size_t fi = i % Nfacecolors;
 	face.second = agg::rgba(*(double*)PyArray_GETPTR2(facecolors, fi, 0),
@@ -999,7 +999,7 @@
 				*(double*)PyArray_GETPTR2(facecolors, fi, 2),
 				*(double*)PyArray_GETPTR2(facecolors, fi, 3));
 }
- 
+
 if (Nedgecolors) {
 	size_t ei = i % Nedgecolors;
 	gc.color = agg::rgba(*(double*)PyArray_GETPTR2(edgecolors, ei, 0),
@@ -1016,7 +1016,7 @@
 	 gc.dashOffset = dashes[i % Nlinestyles].first;
 	}
 }
- 
+
 gc.isaa = bool(Py::Int(antialiaseds[i % Naa]));
 
 _draw_path(path, trans, has_clippath, face, gc, check_snap);
@@ -1044,7 +1044,7 @@
 m_paths(paths), m_npaths(paths.size()) {
 
 }
- 
+
 inline size_t num_paths() const {
 return m_npaths;
 }
@@ -1058,7 +1058,7 @@
 RendererAgg::draw_path_collection(const Py::Tuple& args) {
 _VERBOSE("RendererAgg::draw_path_collection");
 args.verify_length(13);
- 
+
 //segments, trans, clipbox, colors, linewidths, antialiaseds
 agg::trans_affine	 master_transform = py_to_agg_transformation_matrix(args[0]);
 Py::Object		 cliprect	 = args[1];
@@ -1108,7 +1108,7 @@
 QuadMeshPathIterator(size_t m, size_t n, PyArrayObject* coordinates) :
 m_iterator(0), m_m(m), m_n(n), m_coordinates(coordinates) {
 }
- 
+
 static const size_t offsets[5][2];
 
 inline unsigned vertex(unsigned idx, double* x, double* y) {
@@ -1127,7 +1127,7 @@
 inline void rewind(unsigned path_id) {
 m_iterator = path_id;
 }
- 
+
 inline unsigned total_vertices() {
 return 5;
 }
@@ -1146,14 +1146,14 @@
 if (!coordinates_array) {
 throw Py::ValueError("Invalid coordinates array.");
 }
- 
+
 PyArray_Dims shape;
 npy_intp dims[] = { meshHeight + 1, meshWidth + 1, 2 };
 shape.ptr = dims;
 shape.len = 3;
 m_coordinates = (PyArrayObject*)PyArray_Newshape(coordinates_array, &shape, PyArray_CORDER);
 }
- 
+
 inline ~QuadMeshGenerator() {
 Py_XDECREF(m_coordinates);
 }
@@ -1178,7 +1178,7 @@
 RendererAgg::draw_quad_mesh(const Py::Tuple& args) {
 _VERBOSE("RendererAgg::draw_quad_mesh");
 args.verify_length(12);
- 
+
 //segments, trans, clipbox, colors, linewidths, antialiaseds
 agg::trans_affine	 master_transform = py_to_agg_transformation_matrix(args[0]);
 Py::Object		 cliprect	 = args[1];
@@ -1192,7 +1192,7 @@
 Py::Object facecolors_obj = args[9];
 bool antialiased	 = (bool)Py::Int(args[10]);
 bool showedges = (bool)Py::Int(args[11]);
- 
+
 QuadMeshGenerator path_generator(mesh_width, mesh_height, coordinates);
 
 Py::SeqBase<Py::Object> transforms_obj;
@@ -1238,10 +1238,10 @@
 Py::Object
 RendererAgg::write_rgba(const Py::Tuple& args) {
 _VERBOSE("RendererAgg::write_rgba");
- 
+
 args.verify_length(1);
 std::string fname = Py::String(args[0]);
- 
+
 std::ofstream of2( fname.c_str(), std::ios::binary|std::ios::out);
 for (size_t i=0; i<NUMBYTES; i++) {
 of2.write((char*)&(pixBuffer[i]), sizeof(char));
@@ -1253,7 +1253,7 @@
 PyObject* py_file_obj = (PyObject*)png_get_io_ptr(png_ptr);
 PyObject* write_method = PyObject_GetAttrString(py_file_obj, "write");
 PyObject_CallFunction(write_method, "s#", data, length);
- 
+
 // MGDTODO: Check NULL on failure
 }
 
@@ -1272,9 +1272,9 @@
 RendererAgg::write_png(const Py::Tuple& args)
 {
 _VERBOSE("RendererAgg::write_png");
- 
+
 args.verify_length(1, 2);
- 
+
 FILE *fp = NULL;
 Py::Object py_fileobj = Py::Object(args[0]);
 if (py_fileobj.isString()) {
@@ -1294,34 +1294,34 @@
 png_bytep *row_pointers = NULL;
 png_structp png_ptr = NULL;
 png_infop info_ptr = NULL;
- 
+
 try {
 struct png_color_8_struct sig_bit;
 png_uint_32 row;
- 
+
 row_pointers = new png_bytep[height];
 for (row = 0; row < height; ++row) {
 row_pointers[row] = pixBuffer + row * width * 4;
 }
- 
+
 png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
 if (png_ptr == NULL) {
 throw Py::RuntimeError("Could not create write struct");
 }
- 
+
 info_ptr = png_create_info_struct(png_ptr);
 if (info_ptr == NULL) {
 throw Py::RuntimeError("Could not create info struct");
 }
- 
+
 if (setjmp(png_ptr->jmpbuf)) {
 throw Py::RuntimeError("Error building image");
 }
- 
+
 if (fp) {
 png_init_io(png_ptr, fp);
 } else {
- png_set_write_fn(png_ptr, (void*)py_fileobj.ptr(), 
+ png_set_write_fn(png_ptr, (void*)py_fileobj.ptr(),
 		 &write_png_data, &flush_png_data);
 }
 png_set_IHDR(png_ptr, info_ptr,
@@ -1335,7 +1335,7 @@
 size_t dots_per_meter = (size_t)(dpi / (2.54 / 100.0));
 png_set_pHYs(png_ptr, info_ptr, dots_per_meter, dots_per_meter, PNG_RESOLUTION_METER);
 }
- 
+
 // this a a color image!
 sig_bit.gray = 0;
 sig_bit.red = 8;
@@ -1344,23 +1344,23 @@
 /* if the image has an alpha channel then */
 sig_bit.alpha = 8;
 png_set_sBIT(png_ptr, info_ptr, &sig_bit);
- 
+
 png_write_info(png_ptr, info_ptr);
 png_write_image(png_ptr, row_pointers);
 png_write_end(png_ptr, info_ptr);
- 
+
 /* Changed calls to png_destroy_write_struct to follow
 http://www.libpng.org/pub/png/libpng-manual.txt.
 This ensures the info_ptr memory is released.
 */
- 
+
 } catch (...) {
 if (fp) fclose(fp);
 delete [] row_pointers;
 if (png_ptr && info_ptr) png_destroy_write_struct(&png_ptr, &info_ptr);
 throw;
 }
- 
+
 png_destroy_write_struct(&png_ptr, &info_ptr);
 delete [] row_pointers;
 if (fp) fclose(fp);
@@ -1372,9 +1372,9 @@
 Py::Object
 RendererAgg::tostring_rgb(const Py::Tuple& args) {
 //"Return the rendered buffer as an RGB string";
- 
+
 _VERBOSE("RendererAgg::tostring_rgb");
- 
+
 args.verify_length(0);
 int row_len = width*3;
 unsigned char* buf_tmp = new unsigned char[row_len * height];
@@ -1387,10 +1387,10 @@
 			 width,
 			 height,
 			 row_len);
- 
+
 agg::color_conv(&renderingBufferTmp, renderingBuffer, agg::color_conv_rgba32_to_rgb24());
- 
- 
+
+
 //todo: how to do this with native CXX
 PyObject* o = Py_BuildValue("s#",
 			 buf_tmp,
@@ -1403,9 +1403,9 @@
 Py::Object
 RendererAgg::tostring_argb(const Py::Tuple& args) {
 //"Return the rendered buffer as an RGB string";
- 
+
 _VERBOSE("RendererAgg::tostring_argb");
- 
+
 args.verify_length(0);
 int row_len = width*4;
 unsigned char* buf_tmp = new unsigned char[row_len * height];
@@ -1418,10 +1418,10 @@
 			 width,
 			 height,
 			 row_len);
- 
+
 agg::color_conv(&renderingBufferTmp, renderingBuffer, agg::color_conv_rgba32_to_argb32());
- 
- 
+
+
 //todo: how to do this with native CXX
 PyObject* o = Py_BuildValue("s#",
 			 buf_tmp,
@@ -1433,9 +1433,9 @@
 Py::Object
 RendererAgg::tostring_bgra(const Py::Tuple& args) {
 //"Return the rendered buffer as an RGB string";
- 
+
 _VERBOSE("RendererAgg::tostring_bgra");
- 
+
 args.verify_length(0);
 int row_len = width*4;
 unsigned char* buf_tmp = new unsigned char[row_len * height];
@@ -1448,10 +1448,10 @@
 			 width,
 			 height,
 			 row_len);
- 
+
 agg::color_conv(&renderingBufferTmp, renderingBuffer, agg::color_conv_rgba32_to_bgra32());
- 
- 
+
+
 //todo: how to do this with native CXX
 PyObject* o = Py_BuildValue("s#",
 			 buf_tmp,
@@ -1463,9 +1463,9 @@
 Py::Object
 RendererAgg::buffer_rgba(const Py::Tuple& args) {
 //"expose the rendered buffer as Python buffer object, starting from postion x,y";
- 
+
 _VERBOSE("RendererAgg::buffer_rgba");
- 
+
 args.verify_length(2);
 int startw = Py::Int(args[0]);
 int starth = Py::Int(args[1]);
@@ -1479,12 +1479,12 @@
 Py::Object
 RendererAgg::clear(const Py::Tuple& args) {
 //"clear the rendered buffer";
- 
+
 _VERBOSE("RendererAgg::clear");
- 
+
 args.verify_length(0);
 rendererBase->clear(agg::rgba(1, 1, 1, 0));
- 
+
 return Py::Object();
 }
 
@@ -1492,12 +1492,12 @@
 agg::rgba
 RendererAgg::rgb_to_color(const Py::SeqBase<Py::Object>& rgb, double alpha) {
 _VERBOSE("RendererAgg::rgb_to_color");
- 
+
 double r = Py::Float(rgb[0]);
 double g = Py::Float(rgb[1]);
 double b = Py::Float(rgb[2]);
 return agg::rgba(r, g, b, alpha);
- 
+
 }
 
 
@@ -1510,8 +1510,8 @@
 double p = Py::Float( points ) ;
 //return (int)(p*PIXELS_PER_INCH/72.0*dpi/72.0)+0.5;
 return (int)(p*dpi/72.0)+0.5;
- 
- 
+
+
 }
 
 double
@@ -1524,10 +1524,10 @@
 
 
 RendererAgg::~RendererAgg() {
- 
+
 _VERBOSE("RendererAgg::~RendererAgg");
- 
- 
+
+
 delete slineP8;
 delete slineBin;
 delete theRasterizer;
@@ -1536,7 +1536,7 @@
 delete rendererBase;
 delete pixFmt;
 delete renderingBuffer;
- 
+
 delete alphaMask;
 delete alphaMaskRenderingBuffer;
 delete [] alphaBuffer;
@@ -1545,23 +1545,23 @@
 delete rendererBaseAlphaMask;
 delete rendererAlphaMask;
 delete scanlineAlphaMask;
- 
+
 }
 
 /* ------------ module methods ------------- */
 Py::Object _backend_agg_module::new_renderer (const Py::Tuple &args,
 					 const Py::Dict &kws)
 {
- 
+
 if (args.length() != 3 )
 {
 throw Py::RuntimeError("Incorrect # of args to RendererAgg(width, height, dpi).");
 }
- 
+
 int debug;
 if ( kws.hasKey("debug") ) debug = Py::Int( kws["debug"] );
 else debug=0;
- 
+
 int width = Py::Int(args[0]);
 int height = Py::Int(args[1]);
 double dpi = Py::Float(args[2]);
@@ -1572,7 +1572,7 @@
 void BufferRegion::init_type() {
 behaviors().name("BufferRegion");
 behaviors().doc("A wrapper to pass agg buffer objects to and from the python level");
- 
+
 add_varargs_method("to_string", &BufferRegion::to_string,
 		 "to_string()");
 }
@@ -1582,7 +1582,7 @@
 {
 behaviors().name("RendererAgg");
 behaviors().doc("The agg backend extension module");
- 
+
 add_varargs_method("draw_path", &RendererAgg::draw_path,
 		 "draw_path(gc, path, transform, rgbFace)\n");
 add_varargs_method("draw_path_collection", &RendererAgg::draw_path_collection,
@@ -1620,12 +1620,12 @@
 init_backend_agg(void)
 {
 //static _backend_agg_module* _backend_agg = new _backend_agg_module;
- 
+
 _VERBOSE("init_backend_agg");
- 
+
 import_array();
- 
+
 static _backend_agg_module* _backend_agg = NULL;
 _backend_agg = new _backend_agg_module;
- 
+
 };
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年11月28日 13:40:56
Revision: 4480
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4480&view=rev
Author: mdboom
Date: 2007年11月28日 05:40:54 -0800 (2007年11月28日)
Log Message:
-----------
Fix marker drawing bug, and improve speed (by using buffers on the
stack if possible).
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年11月28日 12:34:04 UTC (rev 4479)
+++ branches/transforms/src/_backend_agg.cpp	2007年11月28日 13:40:54 UTC (rev 4480)
@@ -462,6 +462,8 @@
 return has_clippath;
 }
 
+#define MARKER_CACHE_SIZE 512
+
 Py::Object
 RendererAgg::draw_markers(const Py::Tuple& args) {
 typedef agg::conv_transform<PathIterator>		 transformed_path_t;
@@ -505,6 +507,8 @@
 agg::scanline_storage_aa8 scanlines;
 theRasterizer->reset();
 
+ agg::int8u staticFillCache[MARKER_CACHE_SIZE];
+ agg::int8u staticStrokeCache[MARKER_CACHE_SIZE];
 agg::int8u* fillCache = NULL;
 agg::int8u* strokeCache = NULL;
 
@@ -514,7 +518,10 @@
 theRasterizer->add_path(marker_path_curve);
 agg::render_scanlines(*theRasterizer, *slineP8, scanlines);
 fillSize = scanlines.byte_size();
- fillCache = new agg::int8u[fillSize]; // or any container
+ if (fillSize < MARKER_CACHE_SIZE)
+	fillCache = staticFillCache;
+ else
+	fillCache = new agg::int8u[fillSize];
 scanlines.serialize(fillCache);
 }
 
@@ -526,7 +533,10 @@
 theRasterizer->add_path(stroke);
 agg::render_scanlines(*theRasterizer, *slineP8, scanlines);
 unsigned strokeSize = scanlines.byte_size();
- strokeCache = new agg::int8u[strokeSize]; // or any container
+ if (strokeSize < MARKER_CACHE_SIZE)
+ strokeCache = staticStrokeCache;
+ else
+ strokeCache = new agg::int8u[strokeSize];
 scanlines.serialize(strokeCache);
 
 theRasterizer->reset_clipping();
@@ -539,52 +549,44 @@
 agg::serialized_scanlines_adaptor_aa8 sa;
 agg::serialized_scanlines_adaptor_aa8::embedded_scanline sl;
 
- if (face.first) {
- // render the fill
+ while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
 if (has_clippath) {
 	pixfmt_amask_type pfa(*pixFmt, *alphaMask);
 	amask_ren_type r(pfa);
 	amask_aa_renderer_type ren(r);
-	ren.color(face.second);
-	while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
+
+	if (face.first) {
+	 ren.color(face.second);
 	 sa.init(fillCache, fillSize, x, y);
 	 agg::render_scanlines(sa, sl, ren);
 	}
+	ren.color(gc.color);
+	sa.init(strokeCache, strokeSize, x, y);
+	agg::render_scanlines(sa, sl, ren);
 } else {
-	rendererAA->color(face.second);
-	while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
+	if (face.first) {
+	 rendererAA->color(face.second);
 	 sa.init(fillCache, fillSize, x, y);
 	 agg::render_scanlines(sa, sl, *rendererAA);
 	}
- }
- path_quantized.rewind(0);
- }
 
- //render the stroke
- if (has_clippath) {
- pixfmt_amask_type pfa(*pixFmt, *alphaMask);
- amask_ren_type r(pfa);
- amask_aa_renderer_type ren(r);
- ren.color(gc.color);
- while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
+	rendererAA->color(gc.color);
 	sa.init(strokeCache, strokeSize, x, y);
-	agg::render_scanlines(sa, sl, ren);
- }
- } else {
- rendererAA->color(gc.color);
- while (path_quantized.vertex(&x, &y) != agg::path_cmd_stop) {
-	sa.init(strokeCache, strokeSize, x, y);
 	agg::render_scanlines(sa, sl, *rendererAA);
 }
 }
 } catch(...) {
- delete[] fillCache;
- delete[] strokeCache;
+ if (fillCache != staticFillCache)
+ delete[] fillCache;
+ if (strokeCache != staticStrokeCache)
+ delete[] strokeCache;
 throw;
 }
 
- delete [] fillCache;
- delete [] strokeCache;
+ if (fillCache != staticFillCache)
+ delete[] fillCache;
+ if (strokeCache != staticStrokeCache)
+ delete[] strokeCache;
 
 return Py::Object();
 
@@ -945,9 +947,6 @@
 size_t i = 0;
 
 // Convert all of the transforms up front
- master_transform *= agg::trans_affine_scaling(1.0, -1.0);
- master_transform *= agg::trans_affine_translation(0.0, (double)height);
-
 typedef std::vector<agg::trans_affine> transforms_t;
 transforms_t transforms;
 transforms.reserve(Ntransforms);
@@ -955,6 +954,7 @@
 agg::trans_affine trans = py_to_agg_transformation_matrix
 	(transforms_obj[i], false);
 trans *= master_transform;
+
 transforms.push_back(trans);
 }
 
@@ -996,6 +996,10 @@
 	trans *= agg::trans_affine_translation(xo, yo);
 }
 
+ // These transformations must be done post-offsets
+ trans *= agg::trans_affine_scaling(1.0, -1.0);
+ trans *= agg::trans_affine_translation(0.0, (double)height);
+
 if (Nfacecolors) {
 	size_t fi = i % Nfacecolors;
 	face.second = agg::rgba(*(double*)PyArray_GETPTR2(facecolors, fi, 0),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年12月03日 17:14:24
Revision: 4565
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4565&view=rev
Author: mdboom
Date: 2007年12月03日 09:14:20 -0800 (2007年12月03日)
Log Message:
-----------
Fix bug in pcolormesh.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年12月03日 16:08:12 UTC (rev 4564)
+++ branches/transforms/src/_backend_agg.cpp	2007年12月03日 17:14:20 UTC (rev 4565)
@@ -1145,7 +1145,7 @@
 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;
- double* pair = (double*)PyArray_GETPTR2(m_coordinates, m, n);
+ double* pair = (double*)PyArray_GETPTR2(m_coordinates, n, m);
 *x = *pair++;
 *y = *pair;
 return (idx) ? agg::path_cmd_line_to : agg::path_cmd_move_to;
@@ -1172,7 +1172,7 @@
 
 inline QuadMeshGenerator(size_t meshWidth, size_t meshHeight, const Py::Object& coordinates) :
 m_meshWidth(meshWidth), m_meshHeight(meshHeight), m_coordinates(NULL) {
- PyArrayObject* coordinates_array = (PyArrayObject*)PyArray_FromObject(coordinates.ptr(), PyArray_DOUBLE, 1, 3);
+ PyArrayObject* coordinates_array = (PyArrayObject*)PyArray_FromObject(coordinates.ptr(), PyArray_DOUBLE, 3, 3);
 if (!coordinates_array) {
 throw Py::ValueError("Invalid coordinates array.");
 }
@@ -1189,7 +1189,7 @@
 }
 
 inline path_iterator operator()(size_t i) const {
- return QuadMeshPathIterator(i % m_meshHeight, i / m_meshHeight, m_coordinates);
+ return QuadMeshPathIterator(i % m_meshWidth, i / m_meshWidth, m_coordinates);
 }
 };
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年12月04日 20:06:57
Revision: 4590
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4590&view=rev
Author: mdboom
Date: 2007年12月04日 12:06:45 -0800 (2007年12月04日)
Log Message:
-----------
Bugfix for missing markers. Bugfix for faceted pcolor-based quadmeshes.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年12月04日 19:57:01 UTC (rev 4589)
+++ branches/transforms/src/_backend_agg.cpp	2007年12月04日 20:06:45 UTC (rev 4590)
@@ -506,6 +506,8 @@
 //maxim's suggestions for cached scanlines
 agg::scanline_storage_aa8 scanlines;
 theRasterizer->reset();
+ theRasterizer->reset_clipping();
+ rendererBase->reset_clipping(true);
 
 agg::int8u staticFillCache[MARKER_CACHE_SIZE];
 agg::int8u staticStrokeCache[MARKER_CACHE_SIZE];
@@ -792,8 +794,12 @@
 // Render stroke
 if (gc.linewidth != 0.0) {
 double linewidth = gc.linewidth;
- if (!gc.isaa)
- linewidth = round(linewidth);
+ if (!gc.isaa) {
+ if (linewidth < 0.5)
+	linewidth = 0.5;
+ else
+	linewidth = round(linewidth);
+ }
 if (gc.dashes.size() == 0) {
 stroke_t stroke(path);
 stroke.width(linewidth);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年12月10日 15:03:41
Revision: 4682
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4682&view=rev
Author: mdboom
Date: 2007年12月10日 07:03:33 -0800 (2007年12月10日)
Log Message:
-----------
Draw aligned lines more often than before.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年12月10日 15:00:03 UTC (rev 4681)
+++ branches/transforms/src/_backend_agg.cpp	2007年12月10日 15:03:33 UTC (rev 4682)
@@ -352,8 +352,6 @@
 // pixels
 double x0, y0, x1, y1;
 unsigned code;
- if (path.total_vertices() > 5)
- return false;
 
 code = path.vertex(&x0, &y0);
 trans.transform(&x0, &y0);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
From: <md...@us...> - 2007年12月20日 13:01:11
Revision: 4778
 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=4778&view=rev
Author: mdboom
Date: 2007年12月20日 05:01:07 -0800 (2007年12月20日)
Log Message:
-----------
Minor efficiency improvement.
Modified Paths:
--------------
 branches/transforms/src/_backend_agg.cpp
Modified: branches/transforms/src/_backend_agg.cpp
===================================================================
--- branches/transforms/src/_backend_agg.cpp	2007年12月20日 13:00:48 UTC (rev 4777)
+++ branches/transforms/src/_backend_agg.cpp	2007年12月20日 13:01:07 UTC (rev 4778)
@@ -363,6 +363,9 @@
 double x0, y0, x1, y1;
 unsigned code;
 
+ if (path.total_vertices() > 15)
+ return false;
+
 code = path.vertex(&x0, &y0);
 trans.transform(&x0, &y0);
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /