Skip to content

Commit

Permalink
Use PyCapsule in _imagingft
Browse files Browse the repository at this point in the history
  • Loading branch information
homm committed Sep 2, 2024
1 parent 5ef4c21 commit 830a245
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/_imagingft.c
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,6 @@ font_render(FontObject *self, PyObject *args) {
unsigned char convert_scale; /* scale factor for non-8bpp bitmaps */
PyObject *image;
Imaging im;
Py_ssize_t id;
int mask = 0; /* is FT_LOAD_TARGET_MONO enabled? */
int color = 0; /* is FT_LOAD_COLOR enabled? */
int stroke_width = 0;
Expand Down Expand Up @@ -923,10 +922,9 @@ font_render(FontObject *self, PyObject *args) {
PyMem_Del(glyph_info);
return NULL;
}
PyObject *imageId = PyObject_GetAttrString(image, "id");
id = PyLong_AsSsize_t(imageId);
Py_XDECREF(imageId);
im = (Imaging)id;
PyObject *imagePtr = PyObject_GetAttrString(image, "ptr");
im = (Imaging)PyCapsule_GetPointer(imagePtr, IMAGING_MAGIC);
Py_XDECREF(imagePtr);

x_offset -= stroke_width;
y_offset -= stroke_width;
Expand Down

0 comments on commit 830a245

Please sign in to comment.