@@ -147,7 +147,7 @@ bool point_in_path_impl(const double tx, const double ty, T& path)
147
147
148
148
// The following cases denote the beginning on a new subpath
149
149
if (code == agg::path_cmd_stop ||
150
- (code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
150
+ (code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
151
151
{
152
152
x = sx;
153
153
y = sy;
@@ -190,13 +190,13 @@ bool point_in_path_impl(const double tx, const double ty, T& path)
190
190
vty1 = y;
191
191
}
192
192
while (code != agg::path_cmd_stop &&
193
- (code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly);
193
+ (code & agg::path_cmd_end_poly) != agg::path_cmd_end_poly);
194
194
195
195
yflag1 = (vty1 >= ty);
196
196
if (yflag0 != yflag1)
197
197
{
198
198
if ( ((vty1-ty) * (vtx0-vtx1) >=
199
- (vtx1-tx) * (vty0-vty1)) == yflag1 )
199
+ (vtx1-tx) * (vty0-vty1)) == yflag1 )
200
200
{
201
201
inside_flag ^= 1 ;
202
202
}
@@ -462,7 +462,7 @@ Py::Object _path_module::get_path_collection_extents(const Py::Tuple& args)
462
462
463
463
// segments, trans, clipbox, colors, linewidths, antialiaseds
464
464
agg::trans_affine master_transform = py_to_agg_transformation_matrix (args[0 ].ptr ());
465
- Py::SeqBase<Py::Object> paths = args[1 ];
465
+ Py::SeqBase<Py::Object> paths = args[1 ];
466
466
Py::SeqBase<Py::Object> transforms_obj = args[2 ];
467
467
Py::Object offsets_obj = args[3 ];
468
468
agg::trans_affine offset_trans = py_to_agg_transformation_matrix (args[4 ].ptr (), false );
@@ -474,15 +474,15 @@ Py::Object _path_module::get_path_collection_extents(const Py::Tuple& args)
474
474
{
475
475
offsets = (PyArrayObject*)PyArray_FromObject (offsets_obj.ptr (), PyArray_DOUBLE, 0 , 2 );
476
476
if (!offsets ||
477
- (PyArray_NDIM (offsets) == 2 && PyArray_DIM (offsets, 1 ) != 2 ) ||
478
- (PyArray_NDIM (offsets) == 1 && PyArray_DIM (offsets, 0 ) != 0 ))
477
+ (PyArray_NDIM (offsets) == 2 && PyArray_DIM (offsets, 1 ) != 2 ) ||
478
+ (PyArray_NDIM (offsets) == 1 && PyArray_DIM (offsets, 0 ) != 0 ))
479
479
{
480
480
throw Py::ValueError (" Offsets array must be Nx2" );
481
481
}
482
482
483
483
size_t Npaths = paths.length ();
484
484
size_t Noffsets = offsets->dimensions [0 ];
485
- size_t N = std::max (Npaths, Noffsets);
485
+ size_t N = std::max (Npaths, Noffsets);
486
486
size_t Ntransforms = std::min (transforms_obj.length (), N);
487
487
size_t i;
488
488
@@ -555,16 +555,16 @@ Py::Object _path_module::point_in_path_collection(const Py::Tuple& args)
555
555
double y = Py::Float (args[1 ]);
556
556
double radius = Py::Float (args[2 ]);
557
557
agg::trans_affine master_transform = py_to_agg_transformation_matrix (args[3 ].ptr ());
558
- Py::SeqBase<Py::Object> paths = args[4 ];
558
+ Py::SeqBase<Py::Object> paths = args[4 ];
559
559
Py::SeqBase<Py::Object> transforms_obj = args[5 ];
560
560
Py::SeqBase<Py::Object> offsets_obj = args[6 ];
561
561
agg::trans_affine offset_trans = py_to_agg_transformation_matrix (args[7 ].ptr ());
562
562
bool filled = Py::Int (args[8 ]);
563
563
564
564
PyArrayObject* offsets = (PyArrayObject*)PyArray_FromObject (offsets_obj.ptr (), PyArray_DOUBLE, 0 , 2 );
565
565
if (!offsets ||
566
- (PyArray_NDIM (offsets) == 2 && PyArray_DIM (offsets, 1 ) != 2 ) ||
567
- (PyArray_NDIM (offsets) == 1 && PyArray_DIM (offsets, 0 ) != 0 ))
566
+ (PyArray_NDIM (offsets) == 2 && PyArray_DIM (offsets, 1 ) != 2 ) ||
567
+ (PyArray_NDIM (offsets) == 1 && PyArray_DIM (offsets, 0 ) != 0 ))
568
568
{
569
569
Py_XDECREF (offsets);
570
570
throw Py::ValueError (" Offsets array must be Nx2" );
@@ -888,7 +888,7 @@ Py::Object _path_module::clip_path_to_rect(const Py::Tuple &args)
888
888
}
889
889
for (size_t i = 0 ; i < size; ++i)
890
890
{
891
- ((double *)pyarray->data )[2 *i] = (*p)[i].x ;
891
+ ((double *)pyarray->data )[2 *i] = (*p)[i].x ;
892
892
((double *)pyarray->data )[2 *i+1 ] = (*p)[i].y ;
893
893
}
894
894
if (PyList_SetItem (py_results, p - results.begin (), (PyObject *)pyarray) != -1 )
@@ -922,14 +922,14 @@ Py::Object _path_module::affine_transform(const Py::Tuple& args)
922
922
vertices = (PyArrayObject*)PyArray_FromObject
923
923
(vertices_obj.ptr (), PyArray_DOUBLE, 1 , 2 );
924
924
if (!vertices ||
925
- (PyArray_NDIM (vertices) == 2 && PyArray_DIM (vertices, 1 ) != 2 ) ||
926
- (PyArray_NDIM (vertices) == 1 && PyArray_DIM (vertices, 0 ) != 2 ))
925
+ (PyArray_NDIM (vertices) == 2 && PyArray_DIM (vertices, 1 ) != 2 ) ||
926
+ (PyArray_NDIM (vertices) == 1 && PyArray_DIM (vertices, 0 ) != 2 ))
927
927
throw Py::ValueError (" Invalid vertices array." );
928
928
929
929
transform = (PyArrayObject*) PyArray_FromObject
930
930
(transform_obj.ptr (), PyArray_DOUBLE, 2 , 2 );
931
931
if (!transform ||
932
- PyArray_DIM (transform, 0 ) != 3 ||
932
+ PyArray_DIM (transform, 0 ) != 3 ||
933
933
PyArray_DIM (transform, 1 ) != 3 )
934
934
throw Py::ValueError (" Invalid transform." );
935
935
@@ -1010,7 +1010,7 @@ Py::Object _path_module::count_bboxes_overlapping_bbox(const Py::Tuple& args)
1010
1010
{
1011
1011
args.verify_length (2 );
1012
1012
1013
- Py::Object bbox = args[0 ];
1013
+ Py::Object bbox = args[0 ];
1014
1014
Py::SeqBase<Py::Object> bboxes = args[1 ];
1015
1015
1016
1016
double ax0, ay0, ax1, ay1;
@@ -1131,13 +1131,13 @@ Py::Object _path_module::path_intersects_path(const Py::Tuple& args)
1131
1131
1132
1132
void _add_polygon (Py::List& polygons, const std::vector<double >& polygon) {
1133
1133
if (polygon.size () == 0 )
1134
- return ;
1134
+ return ;
1135
1135
npy_intp polygon_dims[] = { polygon.size () / 2 , 2 , 0 };
1136
1136
PyArrayObject* polygon_array = NULL ;
1137
1137
polygon_array = (PyArrayObject*)PyArray_SimpleNew
1138
- (2 , polygon_dims, PyArray_DOUBLE);
1138
+ (2 , polygon_dims, PyArray_DOUBLE);
1139
1139
if (!polygon_array)
1140
- throw Py::MemoryError (" Error creating polygon array" );
1140
+ throw Py::MemoryError (" Error creating polygon array" );
1141
1141
double * polygon_data = (double *)PyArray_DATA (polygon_array);
1142
1142
memcpy (polygon_data, &polygon[0 ], polygon.size () * sizeof (double ));
1143
1143
polygons.append (Py::Object ((PyObject*)polygon_array, true ));
@@ -1179,26 +1179,26 @@ Py::Object _path_module::convert_path_to_polygons(const Py::Tuple& args)
1179
1179
1180
1180
while ((code = curve.vertex (&x, &y)) != agg::path_cmd_stop)
1181
1181
{
1182
- if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
1182
+ if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
1183
1183
{
1184
- if (polygon.size () >= 2 )
1185
- {
1186
- polygon.push_back (polygon[0 ]);
1187
- polygon.push_back (polygon[1 ]);
1188
- _add_polygon (polygons, polygon);
1189
- }
1190
- polygon.clear ();
1191
- }
1184
+ if (polygon.size () >= 2 )
1185
+ {
1186
+ polygon.push_back (polygon[0 ]);
1187
+ polygon.push_back (polygon[1 ]);
1188
+ _add_polygon (polygons, polygon);
1189
+ }
1190
+ polygon.clear ();
1191
+ }
1192
1192
else
1193
1193
{
1194
- if (code == agg::path_cmd_move_to)
1194
+ if (code == agg::path_cmd_move_to)
1195
1195
{
1196
- _add_polygon (polygons, polygon);
1197
- polygon.clear ();
1198
- }
1199
- polygon.push_back (x);
1200
- polygon.push_back (y);
1201
- }
1196
+ _add_polygon (polygons, polygon);
1197
+ polygon.clear ();
1198
+ }
1199
+ polygon.push_back (x);
1200
+ polygon.push_back (y);
1201
+ }
1202
1202
}
1203
1203
1204
1204
_add_polygon (polygons, polygon);
@@ -1356,8 +1356,8 @@ extern "C"
1356
1356
DL_EXPORT (void )
1357
1357
init_path(void )
1358
1358
{
1359
- import_array ();
1360
-
1361
1359
static _path_module* _path = NULL ;
1362
1360
_path = new _path_module;
1361
+
1362
+ import_array ();
1363
1363
}
0 commit comments