mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
fix int boundaries
This commit is contained in:
parent
ef787bc3f5
commit
44e443fa75
|
@ -399,6 +399,18 @@ class CoreResampleRoiTest(PillowTestCase):
|
||||||
|
|
||||||
self.assert_image_equal(tile1, tile2)
|
self.assert_image_equal(tile1, tile2)
|
||||||
|
|
||||||
|
def test_subsample(self):
|
||||||
|
im = hopper()
|
||||||
|
reference = im.crop((0, 0, 125, 125)).resize((26, 26), Image.BICUBIC)
|
||||||
|
supersampled = im.resize((32, 32), Image.BOX)
|
||||||
|
without_roi = supersampled.resize((26, 26), Image.BICUBIC)
|
||||||
|
with_roi = supersampled.resize((26, 26), Image.BICUBIC, (0, 0, 31.25, 31.25))
|
||||||
|
|
||||||
|
self.assert_image_similar(reference, with_roi, 12)
|
||||||
|
|
||||||
|
with self.assertRaisesRegexp(AssertionError, "difference 3\d\."):
|
||||||
|
self.assert_image_similar(reference, without_roi, 10)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
|
|
@ -125,7 +125,7 @@ static inline UINT8 clip8(int in)
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
precompute_coeffs(int inSize, int in0, int in1, int outSize,
|
precompute_coeffs(int inSize, float in0, float in1, int outSize,
|
||||||
struct filter *filterp, int **xboundsp, double **kkp) {
|
struct filter *filterp, int **xboundsp, double **kkp) {
|
||||||
double support, scale, filterscale;
|
double support, scale, filterscale;
|
||||||
double center, ww, ss;
|
double center, ww, ss;
|
||||||
|
@ -238,7 +238,7 @@ normalize_coeffs_8bpc(int outSize, int kmax, double *prekk, INT32 **kkp)
|
||||||
|
|
||||||
|
|
||||||
Imaging
|
Imaging
|
||||||
ImagingResampleHorizontal_8bpc(Imaging imIn, int x0, int x1, int xsize,
|
ImagingResampleHorizontal_8bpc(Imaging imIn, float x0, float x1, int xsize,
|
||||||
struct filter *filterp)
|
struct filter *filterp)
|
||||||
{
|
{
|
||||||
ImagingSectionCookie cookie;
|
ImagingSectionCookie cookie;
|
||||||
|
@ -345,7 +345,7 @@ ImagingResampleHorizontal_8bpc(Imaging imIn, int x0, int x1, int xsize,
|
||||||
|
|
||||||
|
|
||||||
Imaging
|
Imaging
|
||||||
ImagingResampleVertical_8bpc(Imaging imIn, int y0, int y1, int ysize,
|
ImagingResampleVertical_8bpc(Imaging imIn, float y0, float y1, int ysize,
|
||||||
struct filter *filterp)
|
struct filter *filterp)
|
||||||
{
|
{
|
||||||
ImagingSectionCookie cookie;
|
ImagingSectionCookie cookie;
|
||||||
|
@ -452,7 +452,7 @@ ImagingResampleVertical_8bpc(Imaging imIn, int y0, int y1, int ysize,
|
||||||
|
|
||||||
|
|
||||||
Imaging
|
Imaging
|
||||||
ImagingResampleHorizontal_32bpc(Imaging imIn, int x0, int x1, int xsize,
|
ImagingResampleHorizontal_32bpc(Imaging imIn, float x0, float x1, int xsize,
|
||||||
struct filter *filterp)
|
struct filter *filterp)
|
||||||
{
|
{
|
||||||
ImagingSectionCookie cookie;
|
ImagingSectionCookie cookie;
|
||||||
|
@ -514,7 +514,7 @@ ImagingResampleHorizontal_32bpc(Imaging imIn, int x0, int x1, int xsize,
|
||||||
|
|
||||||
|
|
||||||
Imaging
|
Imaging
|
||||||
ImagingResampleVertical_32bpc(Imaging imIn, int y0, int y1, int ysize,
|
ImagingResampleVertical_32bpc(Imaging imIn, float y0, float y1, int ysize,
|
||||||
struct filter *filterp)
|
struct filter *filterp)
|
||||||
{
|
{
|
||||||
ImagingSectionCookie cookie;
|
ImagingSectionCookie cookie;
|
||||||
|
@ -575,7 +575,7 @@ ImagingResampleVertical_32bpc(Imaging imIn, int y0, int y1, int ysize,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typedef Imaging (*ResampleFunction)(Imaging imIn, int x0, int x1, int xsize,
|
typedef Imaging (*ResampleFunction)(Imaging imIn, float x0, float x1, int xsize,
|
||||||
struct filter *filterp);
|
struct filter *filterp);
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user