mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-11-15 06:07:33 +03:00
ImagingSectionEnter for WebPAnimEncoder
This commit is contained in:
parent
8bb3134b1d
commit
0962b468b7
|
@ -190,6 +190,7 @@ _anim_encoder_add(PyObject *self, PyObject *args) {
|
||||||
float quality_factor;
|
float quality_factor;
|
||||||
float alpha_quality_factor;
|
float alpha_quality_factor;
|
||||||
int method;
|
int method;
|
||||||
|
ImagingSectionCookie cookie;
|
||||||
WebPConfig config;
|
WebPConfig config;
|
||||||
WebPAnimEncoderObject *encp = (WebPAnimEncoderObject *)self;
|
WebPAnimEncoderObject *encp = (WebPAnimEncoderObject *)self;
|
||||||
WebPAnimEncoder *enc = encp->enc;
|
WebPAnimEncoder *enc = encp->enc;
|
||||||
|
@ -246,8 +247,11 @@ _anim_encoder_add(PyObject *self, PyObject *args) {
|
||||||
WebPPictureImportRGB(frame, rgb, 3 * width);
|
WebPPictureImportRGB(frame, rgb, 3 * width);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the frame to the encoder
|
ImagingSectionEnter(&cookie);
|
||||||
if (!WebPAnimEncoderAdd(enc, frame, timestamp, &config)) {
|
int ok = WebPAnimEncoderAdd(enc, frame, timestamp, &config);
|
||||||
|
ImagingSectionLeave(&cookie);
|
||||||
|
|
||||||
|
if (!ok) {
|
||||||
PyErr_SetString(PyExc_RuntimeError, WebPAnimEncoderGetError(enc));
|
PyErr_SetString(PyExc_RuntimeError, WebPAnimEncoderGetError(enc));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user