Convert Agg extension to pybind11#27011
Conversation
|
I rebased this on top of #27087 so that I can re-use the type casters that it has. However, there is still an issue with the |
|
@QuLogic When you have time and motivation to come back to this, ping me and I will review it. |
| auto simplify_threshold = src.attr("simplify_threshold").cast<double>(); | ||
|
|
||
| if (!value.set(vertices.ptr(), codes.ptr(), | ||
| if (!value.set(vertices.inc_ref().ptr(), codes.inc_ref().ptr(), |
There was a problem hiding this comment.
I don't know why this change is needed now, but otherwise things randomly crash.
There was a problem hiding this comment.
We think there are decrements in the iterator destructor there is a decr which we think we need to keep as there are still other usages of the iterators from c++ that we need to remove first.
| if (!value.set(vertices.inc_ref().ptr(), codes.inc_ref().ptr(), | ||
| should_simplify, simplify_threshold)) { | ||
| return false; | ||
| throw py::error_already_set(); |
There was a problem hiding this comment.
This was technically wrong before, but otherwise, pybind11 would substitute its own generic "cannot convert type PyType to C++Type" error message, so not fatal.
| /* value.clippath = src.attr("get_clip_path")().cast<ClipPath>(); */ | ||
| convert_clippath(src.attr("get_clip_path")().ptr(), &value.clippath); |
There was a problem hiding this comment.
If I leave the casting version in, then all sorts of memory corruption occurs, and I've yet to figure out why. Instead of wasting even more time on that now, I'd rather get this going, and once we drop NumPy headers, come back to clean this up properly.
11ac056 to
83a882b
Compare
|
I rebased and added the usual |
83a882b to
d0281d0
Compare
This is a _very_ straightforward port, and several parts can be cleaned up in future commits.
This only does the simple ones that are not shared with the path extension. Those more complex ones will be done separately.
d0281d0 to
3fde41c
Compare
PR summary
This is somewhat partially implemented, in that the NumPy array parts are not changed yet. I think I'll want to do path first, to make this simpler. I'll leave this as draft until then.
PR checklist