8000 ft2font: Explicitly cast dimensions when creating Python buffer · matplotlib/matplotlib@5970dfb · GitHub
[go: up one dir, main page]

Skip to content

Commit 5970dfb

Browse files
committed
ft2font: Explicitly cast dimensions when creating Python buffer
On WASM, which is wholly 32-bit, casting unsigned int to signed long is a narrowing conversion, which it seems to treat as an error. The Agg buffer cannot be over `(1<<23)` in width or height, so this cast is safe even with the smaller sizes.
1 parent 36104c6 commit 5970dfb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/_backend_agg_wrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,12 +254,12 @@ PYBIND11_MODULE(_backend_agg, m, py::mod_gil_not_used())
254254

255255
.def_buffer([](RendererAgg *renderer) -> py::buffer_info {
256256
std::vector<py::ssize_t> shape {
257-
renderer->get_height(),
258-
renderer->get_width(),
257+
static_cast<py::ssize_t>(renderer->get_height()),
258+
static_cast<py::ssize_t>(renderer->get_width()),
259259
4
260260
};
261261
std::vector<py::ssize_t> strides {
262-
renderer->get_width() * 4,
262+
static_cast<py::ssize_t>(renderer->get_width() * 4),
263263
4,
264264
1
265265
};

0 commit comments

Comments
 (0)
0