mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Merge pull request #8623 from radarhere/threads
This commit is contained in:
commit
6e66166234
|
@ -346,10 +346,10 @@ pyCMSdoTransform(Imaging im, Imaging imOut, cmsHTRANSFORM hTransform) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
|
|
||||||
// transform color channels only
|
// transform color channels only
|
||||||
for (i = 0; i < im->ysize; i++) {
|
for (i = 0; i < im->ysize; i++) {
|
||||||
cmsDoTransform(hTransform, im->image[i], imOut->image[i], im->xsize);
|
cmsDoTransform(hTransform, im->image[i], imOut->image[i], im->xsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -362,9 +362,9 @@ pyCMSdoTransform(Imaging im, Imaging imOut, cmsHTRANSFORM hTransform) {
|
||||||
// enough available on all platforms, so we polyfill it here for now.
|
// enough available on all platforms, so we polyfill it here for now.
|
||||||
pyCMScopyAux(hTransform, imOut, im);
|
pyCMScopyAux(hTransform, imOut, im);
|
||||||
|
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cmsHTRANSFORM
|
static cmsHTRANSFORM
|
||||||
|
@ -378,17 +378,17 @@ _buildTransform(
|
||||||
) {
|
) {
|
||||||
cmsHTRANSFORM hTransform;
|
cmsHTRANSFORM hTransform;
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
|
|
||||||
/* create the transform */
|
/* create the transform */
|
||||||
hTransform = cmsCreateTransform(
|
hTransform = cmsCreateTransform(
|
||||||
hInputProfile,
|
hInputProfile,
|
||||||
findLCMStype(sInMode),
|
findLCMStype(sInMode),
|
||||||
hOutputProfile,
|
hOutputProfile,
|
||||||
findLCMStype(sOutMode),
|
findLCMStype(sOutMode),
|
||||||
iRenderingIntent,
|
iRenderingIntent,
|
||||||
cmsFLAGS
|
cmsFLAGS
|
||||||
);
|
);
|
||||||
|
|
||||||
Py_END_ALLOW_THREADS;
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
|
@ -412,19 +412,19 @@ _buildProofTransform(
|
||||||
) {
|
) {
|
||||||
cmsHTRANSFORM hTransform;
|
cmsHTRANSFORM hTransform;
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
|
|
||||||
/* create the transform */
|
/* create the transform */
|
||||||
hTransform = cmsCreateProofingTransform(
|
hTransform = cmsCreateProofingTransform(
|
||||||
hInputProfile,
|
hInputProfile,
|
||||||
findLCMStype(sInMode),
|
findLCMStype(sInMode),
|
||||||
hOutputProfile,
|
hOutputProfile,
|
||||||
findLCMStype(sOutMode),
|
findLCMStype(sOutMode),
|
||||||
hProofProfile,
|
hProofProfile,
|
||||||
iRenderingIntent,
|
iRenderingIntent,
|
||||||
iProofIntent,
|
iProofIntent,
|
||||||
cmsFLAGS
|
cmsFLAGS
|
||||||
);
|
);
|
||||||
|
|
||||||
Py_END_ALLOW_THREADS;
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
|
|
|
@ -690,24 +690,26 @@ PyImaging_CreateWindowWin32(PyObject *self, PyObject *args) {
|
||||||
SetWindowLongPtr(wnd, 0, (LONG_PTR)callback);
|
SetWindowLongPtr(wnd, 0, (LONG_PTR)callback);
|
||||||
SetWindowLongPtr(wnd, sizeof(callback), (LONG_PTR)PyThreadState_Get());
|
SetWindowLongPtr(wnd, sizeof(callback), (LONG_PTR)PyThreadState_Get());
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS ShowWindow(wnd, SW_SHOWNORMAL);
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
|
ShowWindow(wnd, SW_SHOWNORMAL);
|
||||||
SetForegroundWindow(wnd); /* to make sure it's visible */
|
SetForegroundWindow(wnd); /* to make sure it's visible */
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
return Py_BuildValue(F_HANDLE, wnd);
|
return Py_BuildValue(F_HANDLE, wnd);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *
|
PyObject *
|
||||||
PyImaging_EventLoopWin32(PyObject *self, PyObject *args) {
|
PyImaging_EventLoopWin32(PyObject *self, PyObject *args) {
|
||||||
MSG msg;
|
MSG msg;
|
||||||
|
|
||||||
Py_BEGIN_ALLOW_THREADS while (mainloop && GetMessage(&msg, NULL, 0, 0)) {
|
Py_BEGIN_ALLOW_THREADS;
|
||||||
|
while (mainloop && GetMessage(&msg, NULL, 0, 0)) {
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
Py_END_ALLOW_THREADS
|
Py_END_ALLOW_THREADS;
|
||||||
|
|
||||||
Py_INCREF(Py_None);
|
Py_INCREF(Py_None);
|
||||||
return Py_None;
|
return Py_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user