@@ -391,12 +391,6 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
391391 // segments, trans, clipbox, colors, linewidths, antialiaseds
392392 Py::SeqBase<Py::Object> segments = args[0 ];
393393
394- /* this line is broken, mysteriously
395- if (!Transformation::check(args[1]))
396- throw Py::TypeError("RendererAgg::draw_line_collection(segments, transform, ...) expected a Transformation instance for transform");
397-
398- */
399-
400394 Transformation* transform = static_cast <Transformation*>(args[1 ].ptr ());
401395
402396 set_clip_from_bbox (args[2 ]);
@@ -420,8 +414,9 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
420414 size_t Naa = antialiaseds.length ();
421415 size_t Noffsets = 0 ;
422416 size_t N = Nsegments;
417+ size_t Ndash = 0 ;
423418
424- Py::Tuple dashtup (linestyle);
419+ Py::SeqBase<Py::Object> dashtup (linestyle);
425420 bool useDashes = dashtup[0 ].ptr () != Py_None;
426421
427422 double offset = 0 ;
@@ -435,14 +430,14 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
435430 offset = points_to_pixels_snapto (dashtup[0 ]);
436431 dashSeq = dashtup[1 ];
437432
438- size_t N = dashSeq.length ();
439- if (N %2 != 0 )
433+ Ndash = dashSeq.length ();
434+ if (Ndash %2 != 0 )
440435 throw Py::ValueError (Printf (" dashes must be an even length sequence; found %d" , N).str ());
441436
442- dasha = new double [N ];
437+ dasha = new double [Ndash ];
443438
444- for (size_t i=0 ; i<N ; i++)
445- dasha[i] = points_to_pixels_snapto (dashSeq[i]);
439+ for (size_t i=0 ; i<Ndash ; i++)
440+ dasha[i] = points_to_pixels (dashSeq[i]);
446441 }
447442
448443
@@ -453,11 +448,11 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
453448
454449 double xo (0.0 ), yo (0.0 ), thisx (0.0 ), thisy (0.0 );
455450 std::pair<double , double > xy;
456- Py::Tuple xyo;
451+ Py::SeqBase<Py::Object> xyo;
457452 Py::SeqBase<Py::Object> xys;
458453 for (size_t i=0 ; i<N; ++i) {
459454 if (usingOffsets) {
460- xyo = Py::Tuple (offsets[i%Noffsets]);
455+ xyo = Py::SeqBase<Py::Object> (offsets[i%Noffsets]);
461456 xo = Py::Float (xyo[0 ]);
462457 yo = Py::Float (xyo[1 ]);
463458 try {
@@ -516,32 +511,9 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
516511 }
517512 else {
518513
519- /*
520- size_t N = dashSeq.length();
521- if (N%2 != 0 )
522- throw Py::ValueError(Printf("dashes must be an even length sequence; found %d", N).str());
523-
524- typedef agg::conv_dash<agg::path_storage> dash_t;
525- dash_t dash(path);
526-
527- double on, off;
528-
529- //dash.dash_start(offset);
530- for (size_t i=0; i<N/2; i+=1) {
531- on = points_to_pixels_snapto(dashSeq[2*i]);
532- off = points_to_pixels_snapto(dashSeq[2*i+1]);
533- dash.add_dash(on, off);
534- }
535- agg::conv_stroke<dash_t> stroke(dash);
536- stroke.line_cap(cap);
537- stroke.line_join(join);
538- stroke.width(lw);
539- theRasterizer->add_path(stroke);
540-
541- */
542514 dash_t dash (path);
543515 // dash.dash_start(offset);
544- for (size_t idash=0 ; idash<N /2 ; idash++)
516+ for (size_t idash=0 ; idash<Ndash /2 ; idash++)
545517 dash.add_dash (dasha[2 *idash], dasha[2 *idash+1 ]);
546518
547519 agg::conv_stroke<dash_t > stroke (dash);
@@ -552,7 +524,7 @@ RendererAgg::draw_line_collection(const Py::Tuple& args) {
552524 }
553525
554526 // get the color and render
555- Py::Tuple rgba = Py::Tuple (colors[ i%Nc]);
527+ Py::SeqBase< Py::Object> rgba (colors[ i%Nc]);
556528 double r = Py::Float (rgba[0 ]);
557529 double g = Py::Float (rgba[1 ]);
558530 double b = Py::Float (rgba[2 ]);
@@ -650,13 +622,13 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
650622 size_t N = (Noffsets>Nverts) ? Noffsets : Nverts;
651623
652624 std::pair<double , double > xyo, xy;
653- Py::Tuple thisverts;
625+ Py::SeqBase<Py::Object> thisverts;
654626 for (size_t i=0 ; i<N; ++i) {
655627
656628 thisverts = verts[i % Nverts];
657629
658630 if (usingOffsets) {
659- Py::Tuple pos = Py::Tuple (offsets[i]);
631+ Py::SeqBase<Py::Object> pos = Py::SeqBase<Py::Object> (offsets[i]);
660632 double xo = Py::Float (pos[0 ]);
661633 double yo = Py::Float (pos[1 ]);
662634 try {
@@ -671,14 +643,14 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
671643 size_t Nverts = thisverts.length ();
672644 agg::path_storage path;
673645
674- Py::Tuple thisvert;
646+ Py::SeqBase<Py::Object> thisvert;
675647
676648
677649 // dump the verts to double arrays so we can do more efficient
678650 // look aheads and behinds when doing snapto pixels
679651 double xs[Nverts], ys[Nverts];
680652 for (size_t j=0 ; j<Nverts; ++j) {
681- thisvert = Py::Tuple ( thisverts[j]) ;
653+ thisvert = thisverts[j];
682654 double x = Py::Float (thisvert[0 ]);
683655 double y = Py::Float (thisvert[1 ]);
684656 try {
@@ -730,7 +702,7 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
730702 path.close_polygon ();
731703 int isaa = Py::Int (antialiaseds[i%Naa]);
732704 // get the facecolor and render
733- Py::Tuple rgba = Py::Tuple (facecolors[ i%Nface]);
705+ Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object> (facecolors[ i%Nface]);
734706 double r = Py::Float (rgba[0 ]);
735707 double g = Py::Float (rgba[1 ]);
736708 double b = Py::Float (rgba[2 ]);
@@ -751,7 +723,7 @@ RendererAgg::draw_poly_collection(const Py::Tuple& args) {
751723 } // renderer face
752724
753725 // get the edgecolor and render
754- rgba = Py::Tuple (edgecolors[ i%Nedge]);
726+ rgba = Py::SeqBase<Py::Object> (edgecolors[ i%Nedge]);
755727 r = Py::Float (rgba[0 ]);
756728 g = Py::Float (rgba[1 ]);
757729 b = Py::Float (rgba[2 ]);
@@ -829,16 +801,16 @@ RendererAgg::draw_regpoly_collection(const Py::Tuple& args) {
829801 // dump the x.y vertices into a double array for faster access
830802 double xverts[Nverts];
831803 double yverts[Nverts];
832- Py::Tuple xy;
804+ Py::SeqBase<Py::Object> xy;
833805 for (size_t i=0 ; i<Nverts; ++i) {
834- xy = Py::Tuple (verts[i]);
806+ xy = Py::SeqBase<Py::Object> (verts[i]);
835807 xverts[i] = Py::Float (xy[0 ]);
836808 yverts[i] = Py::Float (xy[1 ]);
837809 }
838810
839811 std::pair<double , double > offsetPair;
840812 for (size_t i=0 ; i<Noffsets; ++i) {
841- Py::Tuple pos = Py::Tuple (offsets[i]);
813+ Py::SeqBase<Py::Object> pos = Py::SeqBase<Py::Object> (offsets[i]);
842814 double xo = Py::Float (pos[0 ]);
843815 double yo = Py::Float (pos[1 ]);
844816 try {
@@ -867,7 +839,7 @@ RendererAgg::draw_regpoly_collection(const Py::Tuple& args) {
867839 path.close_polygon ();
868840 int isaa = Py::Int (antialiaseds[i%Naa]);
869841 // get the facecolor and render
870- Py::Tuple rgba = Py::Tuple (facecolors[ i%Nface]);
842+ Py::SeqBase<Py::Object> rgba = Py::SeqBase<Py::Object> (facecolors[ i%Nface]);
871843 double r = Py::Float (rgba[0 ]);
872844 double g = Py::Float (rgba[1 ]);
873845 double b = Py::Float (rgba[2 ]);
@@ -888,7 +860,7 @@ RendererAgg::draw_regpoly_collection(const Py::Tuple& args) {
888860 } // renderer face
889861
890862 // get the edgecolor and render
891- rgba = Py::Tuple (edgecolors[ i%Nedge]);
863+ rgba = Py::SeqBase<Py::Object> (edgecolors[ i%Nedge]);
892864 r = Py::Float (rgba[0 ]);
893865 g = Py::Float (rgba[1 ]);
894866 b = Py::Float (rgba[2 ]);
0 commit comments