Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7084132

Browse files
committed
Fix bug in calculating minpos.
svn path=/branches/transforms/; revision=4764
1 parent c7af6e1 commit 7084132

1 file changed

Lines changed: 12 additions & 24 deletions

File tree

src/_path.cpp

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -277,20 +277,12 @@ void get_path_extents(PathIterator& path, const agg::trans_affine& trans,
277277
{
278278
if ((code & agg::path_cmd_end_poly) == agg::path_cmd_end_poly)
279279
continue;
280-
if (x < *x0)
281-
{
282-
*x0 = x;
283-
if (x > 0.0)
284-
*xm = x;
285-
}
286-
if (y < *y0)
287-
{
288-
*y0 = y;
289-
if (y > 0.0)
290-
*ym = y;
291-
}
280+
if (x < *x0) *x0 = x;
281+
if (y < *y0) *y0 = y;
292282
if (x > *x1) *x1 = x;
293283
if (y > *y1) *y1 = y;
284+
if (x > 0.0 && x < *xm) *xm = x;
285+
if (y > 0.0 && y < *ym) *ym = y;
294286
}
295287
}
296288

@@ -435,8 +427,8 @@ Py::Object _path_module::get_path_collection_extents(const Py::Tuple& args)
435427
args.verify_length(5);
436428

437429
//segments, trans, clipbox, colors, linewidths, antialiaseds
438-
agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]);
439-
Py::SeqBase<Py::Object> paths = args[1];
430+
agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[0]);
431+
Py::SeqBase<Py::Object> paths = args[1];
440432
Py::SeqBase<Py::Object> transforms_obj = args[2];
441433
Py::Object offsets_obj = args[3];
442434
agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[4], false);
@@ -523,11 +515,11 @@ Py::Object _path_module::point_in_path_collection(const Py::Tuple& args)
523515
args.verify_length(9);
524516

525517
//segments, trans, clipbox, colors, linewidths, antialiaseds
526-
double x = Py::Float(args[0]);
527-
double y = Py::Float(args[1]);
518+
double x = Py::Float(args[0]);
519+
double y = Py::Float(args[1]);
528520
double radius = Py::Float(args[2]);
529-
agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3]);
530-
Py::SeqBase<Py::Object> paths = args[4];
521+
agg::trans_affine master_transform = py_to_agg_transformation_matrix(args[3]);
522+
Py::SeqBase<Py::Object> paths = args[4];
531523
Py::SeqBase<Py::Object> transforms_obj = args[5];
532524
Py::SeqBase<Py::Object> offsets_obj = args[6];
533525
agg::trans_affine offset_trans = py_to_agg_transformation_matrix(args[7]);
@@ -541,9 +533,9 @@ Py::Object _path_module::point_in_path_collection(const Py::Tuple& args)
541533
throw Py::ValueError("Offsets array must be Nx2");
542534
}
543535

544-
size_t Npaths = paths.length();
536+
size_t Npaths = paths.length();
545537
size_t Noffsets = offsets->dimensions[0];
546-
size_t N = std::max(Npaths, Noffsets);
538+
size_t N = std::max(Npaths, Noffsets);
547539
size_t Ntransforms = std::min(transforms_obj.length(), N);
548540
size_t i;
549541

@@ -919,10 +911,6 @@ Py::Object _path_module::affine_transform(const Py::Tuple& args)
919911
f = *(double*)(row1);
920912
}
921913

922-
// I would have preferred to use PyArray_FromDims here, but on
923-
// 64-bit platforms, PyArray_DIMS() does not return the same thing
924-
// that PyArray_FromDims wants, requiring a copy, which I would
925-
// like to avoid in this critical section.
926914
result = (PyArrayObject*)PyArray_SimpleNew
927915
(PyArray_NDIM(vertices), PyArray_DIMS(vertices), PyArray_DOUBLE);
928916
if (PyArray_NDIM(vertices) == 2)

0 commit comments

Comments
 (0)