File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1099,12 +1099,10 @@ void _add_polygon(Py::List& polygons, const std::vector<double>& polygon) {
10991099 polygon_array = (PyArrayObject*)PyArray_SimpleNew
11001100 (2 , polygon_dims, PyArray_DOUBLE);
11011101 if (!polygon_array)
1102- {
11031102 throw Py::MemoryError (" Error creating polygon array" );
1104- }
11051103 double * polygon_data = (double *)PyArray_DATA (polygon_array);
11061104 memcpy (polygon_data, &polygon[0 ], polygon.size () * sizeof (double ));
1107- polygons.append (Py::Object ((PyObject*)polygon_array));
1105+ polygons.append (Py::Object ((PyObject*)polygon_array, true ));
11081106}
11091107
11101108Py::Object _path_module::convert_path_to_polygons (const Py::Tuple& args)
@@ -1133,6 +1131,8 @@ Py::Object _path_module::convert_path_to_polygons(const Py::Tuple& args)
11331131 double x, y;
11341132 unsigned code;
11351133
1134+ polygon.reserve (path.total_vertices ());
1135+
11361136 while ((code = curve.vertex (&x, &y)) != agg::path_cmd_stop)
11371137 {
11381138 if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly) {
You can’t perform that action at this time.
0 commit comments