mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
less operations in loop
This commit is contained in:
parent
32079b1dcc
commit
a960d440db
|
@ -132,7 +132,7 @@ ImagingTranspose(Imaging imOut, Imaging imIn)
|
||||||
{
|
{
|
||||||
ImagingSectionCookie cookie;
|
ImagingSectionCookie cookie;
|
||||||
int x, y, xx, yy, xxsize, yysize;
|
int x, y, xx, yy, xxsize, yysize;
|
||||||
int size = 64;
|
int size = 128;
|
||||||
|
|
||||||
if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0)
|
if (!imOut || !imIn || strcmp(imIn->mode, imOut->mode) != 0)
|
||||||
return (Imaging) ImagingError_ModeError();
|
return (Imaging) ImagingError_ModeError();
|
||||||
|
@ -142,11 +142,11 @@ ImagingTranspose(Imaging imOut, Imaging imIn)
|
||||||
#define TRANSPOSE(image) \
|
#define TRANSPOSE(image) \
|
||||||
for (y = 0; y < imIn->ysize; y += size) { \
|
for (y = 0; y < imIn->ysize; y += size) { \
|
||||||
for (x = 0; x < imIn->xsize; x += size) { \
|
for (x = 0; x < imIn->xsize; x += size) { \
|
||||||
yysize = size < (imIn->ysize - y) ? size : (imIn->ysize - y); \
|
yysize = y + size < imIn->ysize ? y + size : imIn->ysize; \
|
||||||
xxsize = size < (imIn->xsize - x) ? size : (imIn->xsize - x); \
|
xxsize = x + size < imIn->xsize ? x + size : imIn->xsize; \
|
||||||
for (yy = 0; yy < yysize; yy++) { \
|
for (yy = y; yy < yysize; yy++) { \
|
||||||
for (xx = 0; xx < xxsize; xx++) { \
|
for (xx = x; xx < xxsize; xx++) { \
|
||||||
imOut->image[x + xx][y + yy] = imIn->image[y + yy][x + xx]; \
|
imOut->image[xx][yy] = imIn->image[yy][xx]; \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user