mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-28 02:04:36 +03:00
use ROI in precompute_coeffs
This commit is contained in:
parent
a1fedc0f8a
commit
ef787bc3f5
|
@ -397,6 +397,8 @@ class CoreResampleRoiTest(PillowTestCase):
|
||||||
tile2 = im.resize(big_size, resample)\
|
tile2 = im.resize(big_size, resample)\
|
||||||
.crop(o + (o[0] + size[0], o[1] + size[1]))
|
.crop(o + (o[0] + size[0], o[1] + size[1]))
|
||||||
|
|
||||||
|
self.assert_image_equal(tile1, tile2)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -134,7 +134,7 @@ precompute_coeffs(int inSize, int in0, int in1, int outSize,
|
||||||
double *kk, *k;
|
double *kk, *k;
|
||||||
|
|
||||||
/* prepare for horizontal stretch */
|
/* prepare for horizontal stretch */
|
||||||
filterscale = scale = (double) inSize / outSize;
|
filterscale = scale = (double) (in1 - in0) / outSize;
|
||||||
if (filterscale < 1.0) {
|
if (filterscale < 1.0) {
|
||||||
filterscale = 1.0;
|
filterscale = 1.0;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +163,7 @@ precompute_coeffs(int inSize, int in0, int in1, int outSize,
|
||||||
}
|
}
|
||||||
|
|
||||||
for (xx = 0; xx < outSize; xx++) {
|
for (xx = 0; xx < outSize; xx++) {
|
||||||
center = (xx + 0.5) * scale;
|
center = in0 + (xx + 0.5) * scale;
|
||||||
ww = 0.0;
|
ww = 0.0;
|
||||||
ss = 1.0 / filterscale;
|
ss = 1.0 / filterscale;
|
||||||
xmin = (int) floor(center - support);
|
xmin = (int) floor(center - support);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user