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

Skip to content

Commit 9c4f149

Browse files
committed
Fix deprecated api usage in agg_py_path_iterator.h
1 parent 3658571 commit 9c4f149

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/agg_py_path_iterator.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class PathIterator
5656
}
5757

5858
m_vertices = Py::Object(vertices_arr, true);
59-
if (PyArray_DIM(m_vertices.ptr(), 1) != 2)
59+
if (PyArray_DIM((PyArrayObject*)m_vertices.ptr(), 1) != 2)
6060
{
6161
throw Py::ValueError("Invalid vertices array.");
6262
}
@@ -71,14 +71,15 @@ class PathIterator
7171
}
7272

7373
m_codes = Py::Object(codes_arr, true);
74-
if (PyArray_DIM(m_codes.ptr(), 0) != PyArray_DIM(m_vertices.ptr(), 0))
74+
if (PyArray_DIM((PyArrayObject*)m_codes.ptr(), 0) !=
75+
PyArray_DIM((PyArrayObject*)m_vertices.ptr(), 0))
7576
{
7677
throw Py::ValueError("Codes array is wrong length");
7778
}
7879
}
7980

8081
m_should_simplify = should_simplify_obj.isTrue();
81-
m_total_vertices = PyArray_DIM(m_vertices.ptr(), 0);
82+
m_total_vertices = PyArray_DIM((PyArrayObject*)m_vertices.ptr(), 0);
8283
m_simplify_threshold = Py::Float(simplify_threshold_obj);
8384
}
8485

@@ -93,13 +94,13 @@ class PathIterator
9394

9495
const size_t idx = m_iterator++;
9596

96-
char* pair = (char*)PyArray_GETPTR2(m_vertices.ptr(), idx, 0);
97+
char* pair = (char*)PyArray_GETPTR2((PyArrayObject*)m_vertices.ptr(), idx, 0);
9798
*x = *(double*)pair;
98-
*y = *(double*)(pair + PyArray_STRIDE(m_vertices.ptr(), 1));
99+
*y = *(double*)(pair + PyArray_STRIDE((PyArrayObject*)m_vertices.ptr(), 1));
99100

100101
if (!m_codes.isNone())
101102
{
102-
return (unsigned)(*(char *)PyArray_GETPTR1(m_codes.ptr(), idx));
103+
return (unsigned)(*(char *)PyArray_GETPTR1((PyArrayObject*)m_codes.ptr(), idx));
103104
}
104105
else
105106
{

0 commit comments

Comments
 (0)