Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MeetWq committed Sep 17, 2024
1 parent 74e8bdd commit 6d8383c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/skia/Picture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ class PyPicture : public SkPicture {
class PyBBoxHierarchy : public SkBBoxHierarchy {
public:
using SkBBoxHierarchy::SkBBoxHierarchy;

// https://pybind11.readthedocs.io/en/stable/advanced/classes.html#different-method-signatures
void insert(const SkRect rects[], int N) override {
pybind11::gil_scoped_acquire gil;
pybind11::function override = pybind11::get_override(this, "insert");
Expand All @@ -49,8 +51,7 @@ class PyBBoxHierarchy : public SkBBoxHierarchy {
if (override) {
auto obj = override(query);
if (py::isinstance<py::list>(obj)) {
auto results_vec = obj.cast<std::vector<int>>();
result = &results_vec;
*results = obj.cast<std::vector<int>>();
}
}
}
Expand Down

0 comments on commit 6d8383c

Please sign in to comment.