mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-28 17:10:02 +03:00
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
This commit is contained in:
parent
d44e938f93
commit
af50854af6
|
@ -308,8 +308,8 @@ _new_arrow(PyObject *self, PyObject *args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ImagingBorrowArrow is responsible for retaining the array_capsule
|
// ImagingBorrowArrow is responsible for retaining the array_capsule
|
||||||
ret =
|
ret = PyImagingNew(
|
||||||
PyImagingNew(ImagingNewArrow(mode, xsize, ysize, schema_capsule, array_capsule)
|
ImagingNewArrow(mode, xsize, ysize, schema_capsule, array_capsule)
|
||||||
);
|
);
|
||||||
if (!ret) {
|
if (!ret) {
|
||||||
return ImagingError_ValueError("Invalid Arrow array mode or size mismatch");
|
return ImagingError_ValueError("Invalid Arrow array mode or size mismatch");
|
||||||
|
@ -1665,7 +1665,8 @@ _putdata(ImagingObject *self, PyObject *args) {
|
||||||
int bigendian = 0;
|
int bigendian = 0;
|
||||||
if (image->type == IMAGING_TYPE_SPECIAL) {
|
if (image->type == IMAGING_TYPE_SPECIAL) {
|
||||||
// I;16*
|
// I;16*
|
||||||
if (strcmp(image->mode, "I;16B") == 0
|
if (
|
||||||
|
strcmp(image->mode, "I;16B") == 0
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
|| strcmp(image->mode, "I;16N") == 0
|
|| strcmp(image->mode, "I;16N") == 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -327,11 +327,11 @@ PyImaging_GrabScreenWin32(PyObject *self, PyObject *args) {
|
||||||
// added in Windows 10 (1607)
|
// added in Windows 10 (1607)
|
||||||
// loaded dynamically to avoid link errors
|
// loaded dynamically to avoid link errors
|
||||||
user32 = LoadLibraryA("User32.dll");
|
user32 = LoadLibraryA("User32.dll");
|
||||||
SetThreadDpiAwarenessContext_function = (Func_SetThreadDpiAwarenessContext
|
SetThreadDpiAwarenessContext_function = (Func_SetThreadDpiAwarenessContext)
|
||||||
)GetProcAddress(user32, "SetThreadDpiAwarenessContext");
|
GetProcAddress(user32, "SetThreadDpiAwarenessContext");
|
||||||
if (SetThreadDpiAwarenessContext_function != NULL) {
|
if (SetThreadDpiAwarenessContext_function != NULL) {
|
||||||
GetWindowDpiAwarenessContext_function = (Func_GetWindowDpiAwarenessContext
|
GetWindowDpiAwarenessContext_function = (Func_GetWindowDpiAwarenessContext)
|
||||||
)GetProcAddress(user32, "GetWindowDpiAwarenessContext");
|
GetProcAddress(user32, "GetWindowDpiAwarenessContext");
|
||||||
if (screens == -1 && GetWindowDpiAwarenessContext_function != NULL) {
|
if (screens == -1 && GetWindowDpiAwarenessContext_function != NULL) {
|
||||||
dpiAwareness = GetWindowDpiAwarenessContext_function(wnd);
|
dpiAwareness = GetWindowDpiAwarenessContext_function(wnd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,8 +118,9 @@ ImagingFillRadialGradient(const char *mode) {
|
||||||
|
|
||||||
for (y = 0; y < 256; y++) {
|
for (y = 0; y < 256; y++) {
|
||||||
for (x = 0; x < 256; x++) {
|
for (x = 0; x < 256; x++) {
|
||||||
d = (int
|
d = (int)sqrt(
|
||||||
)sqrt((double)((x - 128) * (x - 128) + (y - 128) * (y - 128)) * 2.0);
|
(double)((x - 128) * (x - 128) + (y - 128) * (y - 128)) * 2.0
|
||||||
|
);
|
||||||
if (d >= 255) {
|
if (d >= 255) {
|
||||||
d = 255;
|
d = 255;
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,7 +155,8 @@ ImagingFilter3x3(Imaging imOut, Imaging im, const float *kernel, float offset) {
|
||||||
} else {
|
} else {
|
||||||
int bigendian = 0;
|
int bigendian = 0;
|
||||||
if (im->type == IMAGING_TYPE_SPECIAL) {
|
if (im->type == IMAGING_TYPE_SPECIAL) {
|
||||||
if (strcmp(im->mode, "I;16B") == 0
|
if (
|
||||||
|
strcmp(im->mode, "I;16B") == 0
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
|| strcmp(im->mode, "I;16N") == 0
|
|| strcmp(im->mode, "I;16N") == 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -308,7 +309,8 @@ ImagingFilter5x5(Imaging imOut, Imaging im, const float *kernel, float offset) {
|
||||||
} else {
|
} else {
|
||||||
int bigendian = 0;
|
int bigendian = 0;
|
||||||
if (im->type == IMAGING_TYPE_SPECIAL) {
|
if (im->type == IMAGING_TYPE_SPECIAL) {
|
||||||
if (strcmp(im->mode, "I;16B") == 0
|
if (
|
||||||
|
strcmp(im->mode, "I;16B") == 0
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
|| strcmp(im->mode, "I;16N") == 0
|
|| strcmp(im->mode, "I;16N") == 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -207,8 +207,8 @@ j2k_set_cinema_params(Imaging im, int components, opj_cparameters_t *params) {
|
||||||
|
|
||||||
if (params->cp_cinema == OPJ_CINEMA4K_24) {
|
if (params->cp_cinema == OPJ_CINEMA4K_24) {
|
||||||
float max_rate =
|
float max_rate =
|
||||||
((float)(components * im->xsize * im->ysize * 8) / (CINEMA_24_CS_LENGTH * 8)
|
((float)(components * im->xsize * im->ysize * 8) /
|
||||||
);
|
(CINEMA_24_CS_LENGTH * 8));
|
||||||
|
|
||||||
params->POC[0].tile = 1;
|
params->POC[0].tile = 1;
|
||||||
params->POC[0].resno0 = 0;
|
params->POC[0].resno0 = 0;
|
||||||
|
@ -243,8 +243,8 @@ j2k_set_cinema_params(Imaging im, int components, opj_cparameters_t *params) {
|
||||||
params->max_comp_size = COMP_24_CS_MAX_LENGTH;
|
params->max_comp_size = COMP_24_CS_MAX_LENGTH;
|
||||||
} else {
|
} else {
|
||||||
float max_rate =
|
float max_rate =
|
||||||
((float)(components * im->xsize * im->ysize * 8) / (CINEMA_48_CS_LENGTH * 8)
|
((float)(components * im->xsize * im->ysize * 8) /
|
||||||
);
|
(CINEMA_48_CS_LENGTH * 8));
|
||||||
|
|
||||||
for (n = 0; n < params->tcp_numlayers; ++n) {
|
for (n = 0; n < params->tcp_numlayers; ++n) {
|
||||||
rate = 0;
|
rate = 0;
|
||||||
|
|
|
@ -197,8 +197,9 @@ ImagingPoint(Imaging imIn, const char *mode, const void *table) {
|
||||||
return imOut;
|
return imOut;
|
||||||
|
|
||||||
mode_mismatch:
|
mode_mismatch:
|
||||||
return (Imaging
|
return (Imaging)ImagingError_ValueError(
|
||||||
)ImagingError_ValueError("point operation not supported for this mode");
|
"point operation not supported for this mode"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Imaging
|
Imaging
|
||||||
|
|
|
@ -470,7 +470,8 @@ ImagingResampleHorizontal_16bpc(
|
||||||
double *k;
|
double *k;
|
||||||
|
|
||||||
int bigendian = 0;
|
int bigendian = 0;
|
||||||
if (strcmp(imIn->mode, "I;16N") == 0
|
if (
|
||||||
|
strcmp(imIn->mode, "I;16N") == 0
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
|| strcmp(imIn->mode, "I;16B") == 0
|
|| strcmp(imIn->mode, "I;16B") == 0
|
||||||
#endif
|
#endif
|
||||||
|
@ -509,7 +510,8 @@ ImagingResampleVertical_16bpc(
|
||||||
double *k;
|
double *k;
|
||||||
|
|
||||||
int bigendian = 0;
|
int bigendian = 0;
|
||||||
if (strcmp(imIn->mode, "I;16N") == 0
|
if (
|
||||||
|
strcmp(imIn->mode, "I;16N") == 0
|
||||||
#ifdef WORDS_BIGENDIAN
|
#ifdef WORDS_BIGENDIAN
|
||||||
|| strcmp(imIn->mode, "I;16B") == 0
|
|| strcmp(imIn->mode, "I;16B") == 0
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -602,8 +602,9 @@ ImagingBorrowArrow(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!borrowed_buffer) {
|
if (!borrowed_buffer) {
|
||||||
return (Imaging
|
return (Imaging)ImagingError_ValueError(
|
||||||
)ImagingError_ValueError("Arrow Array, exactly 2 buffers required");
|
"Arrow Array, exactly 2 buffers required"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (y = i = 0; y < im->ysize; y++) {
|
for (y = i = 0; y < im->ysize; y++) {
|
||||||
|
|
|
@ -557,7 +557,8 @@ _decodeStrip(
|
||||||
(tdata_t)state->buffer,
|
(tdata_t)state->buffer,
|
||||||
strip_size
|
strip_size
|
||||||
) == -1) {
|
) == -1) {
|
||||||
TRACE(("Decode Error, strip %d\n", TIFFComputeStrip(tiff, state->y, 0))
|
TRACE(
|
||||||
|
("Decode Error, strip %d\n", TIFFComputeStrip(tiff, state->y, 0))
|
||||||
);
|
);
|
||||||
state->errcode = IMAGING_CODEC_BROKEN;
|
state->errcode = IMAGING_CODEC_BROKEN;
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user