@@ -40,17 +40,11 @@ PyBufferRegion_get_extents(BufferRegion *self)
4040
4141static void
4242PyRendererAgg_draw_path (RendererAgg *self,
43- pybind11::object gc_obj ,
43+ GCAgg &gc ,
4444 mpl::PathIterator path,
4545 agg::trans_affine trans,
4646 agg::rgba face)
4747{
48- GCAgg gc;
49-
50- if (!convert_gcagg (gc_obj.ptr (), &gc)) {
51- throw pybind11::error_already_set ();
52- }
53-
5448 self->draw_path (gc, path, trans, face);
5549}
5650
@@ -60,52 +54,38 @@ PyRendererAgg_draw_text_image(RendererAgg *self,
6054 double x,
6155 double y,
6256 double angle,
63- pybind11::object gc_obj )
57+ GCAgg &gc )
6458{
6559 numpy::array_view<agg::int8u, 2 > image;
66- GCAgg gc;
6760
6861 if (!image.converter_contiguous (image_obj.ptr (), &image)) {
6962 throw pybind11::error_already_set ();
7063 }
71- if (!convert_gcagg (gc_obj.ptr (), &gc)) {
72- throw pybind11::error_already_set ();
73- }
7464
7565 self->draw_text_image (gc, image, x, y, angle);
7666}
7767
7868static void
7969PyRendererAgg_draw_markers (RendererAgg *self,
80- pybind11::object gc_obj ,
70+ GCAgg &gc ,
8171 mpl::PathIterator marker_path,
8272 agg::trans_affine marker_path_trans,
8373 mpl::PathIterator path,
8474 agg::trans_affine trans,
8575 agg::rgba face)
8676{
87- GCAgg gc;
88-
89- if (!convert_gcagg (gc_obj.ptr (), &gc)) {
90- throw pybind11::error_already_set ();
91- }
92-
9377 self->draw_markers (gc, marker_path, marker_path_trans, path, trans, face);
9478}
9579
9680static void
9781PyRendererAgg_draw_image (RendererAgg *self,
98- pybind11::object gc_obj ,
82+ GCAgg &gc ,
9983 double x,
10084 double y,
10185 pybind11::array_t <agg::int8u, pybind11::array::c_style> image_obj)
10286{
103- GCAgg gc;
10487 numpy::array_view<agg::int8u, 3 > image;
10588
106- if (!convert_gcagg (gc_obj.ptr (), &gc)) {
107- throw pybind11::error_already_set ();
108- }
10989 if (!image.set (image_obj.ptr ())) {
11090 throw pybind11::error_already_set ();
11191 }
@@ -119,7 +99,7 @@ PyRendererAgg_draw_image(RendererAgg *self,
11999
120100static void
121101PyRendererAgg_draw_path_collection (RendererAgg *self,
122- pybind11::object gc_obj ,
102+ GCAgg &gc ,
123103 agg::trans_affine master_transform,
124104 pybind11::object paths_obj,
125105 pybind11::object transforms_obj,
@@ -128,25 +108,20 @@ PyRendererAgg_draw_path_collection(RendererAgg *self,
128108 pybind11::object facecolors_obj,
129109 pybind11::object edgecolors_obj,
130110 pybind11::object linewidths_obj,
131- pybind11::object dashes_obj ,
111+ DashesVector dashes ,
132112 pybind11::object antialiaseds_obj,
133113 pybind11::object Py_UNUSED (ignored_obj),
134114 // offset position is no longer used
135115 pybind11::object Py_UNUSED(offset_position_obj))
136116{
137- GCAgg gc;
138117 mpl::PathGenerator paths;
139118 numpy::array_view<const double , 3 > transforms;
140119 numpy::array_view<const double , 2 > offsets;
141120 numpy::array_view<const double , 2 > facecolors;
142121 numpy::array_view<const double , 2 > edgecolors;
143122 numpy::array_view<const double , 1 > linewidths;
144- DashesVector dashes;
145123 numpy::array_view<const uint8_t , 1 > antialiaseds;
146124
147- if (!convert_gcagg (gc_obj.ptr (), &gc)) {
148- throw pybind11::error_already_set ();
149- }
150125 if (!convert_pathgen (paths_obj.ptr (), &paths)) {
151126 throw pybind11::error_already_set ();
152127 }
@@ -165,9 +140,6 @@ PyRendererAgg_draw_path_collection(RendererAgg *self,
165140 if (!linewidths.converter (linewidths_obj.ptr (), &linewidths)) {
166141 throw pybind11::error_already_set ();
167142 }
168- if (!convert_dashes_vector (dashes_obj.ptr (), &dashes)) {
169- throw pybind11::error_already_set ();
170- }
171143 if (!antialiaseds.converter (antialiaseds_obj.ptr (), &antialiaseds)) {
172144 throw pybind11::error_already_set ();
173145 }
@@ -187,7 +159,7 @@ PyRendererAgg_draw_path_collection(RendererAgg *self,
187159
188160static void
189161PyRendererAgg_draw_quad_mesh (RendererAgg *self,
190- pybind11::object gc_obj ,
162+ GCAgg &gc ,
191163 agg::trans_affine master_transform,
192164 unsigned int mesh_width,
193165 unsigned int mesh_height,
@@ -198,15 +170,11 @@ PyRendererAgg_draw_quad_mesh(RendererAgg *self,
198170 bool antialiased,
199171 pybind11::object edgecolors_obj)
200172{
201- GCAgg gc;
202173 numpy::array_view<const double , 3 > coordinates;
203174 numpy::array_view<const double , 2 > offsets;
204175 numpy::array_view<const double , 2 > facecolors;
205176 numpy::array_view<const double , 2 > edgecolors;
206177
207- if (!convert_gcagg (gc_obj.ptr (), &gc)) {
208- throw pybind11::error_already_set ();
209- }
210178 if (!coordinates.converter (coordinates_obj.ptr (), &coordinates)) {
211179 throw pybind11::error_already_set ();
212180 }
@@ -234,18 +202,14 @@ PyRendererAgg_draw_quad_mesh(RendererAgg *self,
234202
235203static void
236204PyRendererAgg_draw_gouraud_triangles (RendererAgg *self,
237- pybind11::object gc_obj ,
205+ GCAgg &gc ,
238206 pybind11::object points_obj,
239207 pybind11::object colors_obj,
240208 agg::trans_affine trans)
241209{
242- GCAgg gc;
243210 numpy::array_view<const double , 3 > points;
244211 numpy::array_view<const double , 3 > colors;
245212
246- if (!convert_gcagg (gc_obj.ptr (), &gc)) {
247- throw pybind11::error_already_set ();
248- }
249213 if (!points.converter (points_obj.ptr (), &points)) {
250214 throw pybind11::error_already_set ();
251215 }
0 commit comments