mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-11 04:07:21 +03:00
Fixed deallocating mask images
This commit is contained in:
parent
8c1dc819fd
commit
39a3b1d83e
|
@ -562,9 +562,17 @@ class FreeTypeFont:
|
||||||
_string_length_check(text)
|
_string_length_check(text)
|
||||||
if start is None:
|
if start is None:
|
||||||
start = (0, 0)
|
start = (0, 0)
|
||||||
im, size, offset = self.font.render(
|
im = None
|
||||||
|
|
||||||
|
def fill(mode, size):
|
||||||
|
nonlocal im
|
||||||
|
|
||||||
|
im = Image.core.fill(mode, size)
|
||||||
|
return im
|
||||||
|
|
||||||
|
size, offset = self.font.render(
|
||||||
text,
|
text,
|
||||||
Image.core.fill,
|
fill,
|
||||||
mode,
|
mode,
|
||||||
direction,
|
direction,
|
||||||
features,
|
features,
|
||||||
|
|
|
@ -882,7 +882,7 @@ font_render(FontObject *self, PyObject *args) {
|
||||||
if (max_image_pixels != Py_None) {
|
if (max_image_pixels != Py_None) {
|
||||||
if ((long long)(width > 1 ? width : 1) * (height > 1 ? height : 1) > PyLong_AsLongLong(max_image_pixels) * 2) {
|
if ((long long)(width > 1 ? width : 1) * (height > 1 ? height : 1) > PyLong_AsLongLong(max_image_pixels) * 2) {
|
||||||
PyMem_Del(glyph_info);
|
PyMem_Del(glyph_info);
|
||||||
return Py_BuildValue("O(ii)(ii)", Py_None, width, height, 0, 0);
|
return Py_BuildValue("(ii)(ii)", width, height, 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -898,7 +898,7 @@ font_render(FontObject *self, PyObject *args) {
|
||||||
y_offset -= stroke_width;
|
y_offset -= stroke_width;
|
||||||
if (count == 0 || width == 0 || height == 0) {
|
if (count == 0 || width == 0 || height == 0) {
|
||||||
PyMem_Del(glyph_info);
|
PyMem_Del(glyph_info);
|
||||||
return Py_BuildValue("O(ii)(ii)", image, width, height, x_offset, y_offset);
|
return Py_BuildValue("(ii)(ii)", width, height, x_offset, y_offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stroke_width) {
|
if (stroke_width) {
|
||||||
|
@ -1113,9 +1113,10 @@ font_render(FontObject *self, PyObject *args) {
|
||||||
if (bitmap_converted_ready) {
|
if (bitmap_converted_ready) {
|
||||||
FT_Bitmap_Done(library, &bitmap_converted);
|
FT_Bitmap_Done(library, &bitmap_converted);
|
||||||
}
|
}
|
||||||
|
Py_DECREF(image);
|
||||||
FT_Stroker_Done(stroker);
|
FT_Stroker_Done(stroker);
|
||||||
PyMem_Del(glyph_info);
|
PyMem_Del(glyph_info);
|
||||||
return Py_BuildValue("O(ii)(ii)", image, width, height, x_offset, y_offset);
|
return Py_BuildValue("(ii)(ii)", width, height, x_offset, y_offset);
|
||||||
|
|
||||||
glyph_error:
|
glyph_error:
|
||||||
if (im->destroy) {
|
if (im->destroy) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user