@@ -188,11 +188,11 @@ GCAgg::_set_clip_rectangle( const Py::Object& gc) {
188188
189189
190190Py::Object BufferRegion::to_string (const Py::Tuple &args) {
191-
191+
192192 // owned=true to prevent memory leak
193193 return Py::String (PyString_FromStringAndSize ((const char *)aggbuf.data ,aggbuf.height *aggbuf.stride ), true );
194- }
195-
194+ }
195+
196196
197197
198198
@@ -385,8 +385,14 @@ RendererAgg::draw_ellipse(const Py::Tuple& args) {
385385
386386 set_clipbox_rasterizer (gc.cliprect );
387387
388- // last arg is num steps
389- agg::ellipse path (x, height-y, w, h, 100 );
388+ // Approximate the ellipse with 4 bezier paths
389+ agg::path_storage path;
390+ path.move_to (x, height-(y+h));
391+ path.arc_to (w, h, 0.0 , false , true , x+w, height-y);
392+ path.arc_to (w, h, 0.0 , false , true , x, height-(y-h));
393+ path.arc_to (w, h, 0.0 , false , true , x-w, height-y);
394+ path.arc_to (w, h, 0.0 , false , true , x, height-(y+h));
395+ path.close_polygon ();
390396
391397 _fill_and_stroke (path, gc, face);
392398 return Py::Object ();
@@ -640,7 +646,7 @@ RendererAgg::copy_from_bbox(const Py::Tuple& args) {
640646 */
641647 int boxwidth = r.x2 -r.x1 ;
642648 int boxheight = r.y2 -r.y1 ;
643- int boxstride = boxwidth*4 ;
649+ int boxstride = boxwidth*4 ;
644650 agg::buffer buf (boxwidth, boxheight, boxstride, false );
645651 if (buf.data ==NULL ) {
646652 throw Py::MemoryError (" RendererAgg::copy_from_bbox could not allocate memory for buffer" );
@@ -2186,7 +2192,7 @@ RendererAgg::buffer_rgba(const Py::Tuple& args) {
21862192 int row_len = width*4 ;
21872193 int start=row_len*starth+startw*4 ;
21882194 return Py::asObject (PyBuffer_FromMemory ( pixBuffer+start, row_len*height-start));
2189- }
2195+ }
21902196
21912197
21922198
0 commit comments