and... fix the smooth scaler.. i had a 32bit overflow there for when images

get bigger than 2048x2048 and i scale them up... :)


SVN revision: 6527
This commit is contained in:
Carsten Haitzler 2002-12-29 02:54:47 +00:00
parent d1d3b62ebe
commit 01a3ea467f
1 changed files with 24 additions and 6 deletions

View File

@ -283,9 +283,18 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst,
{ {
lin_ptr[x] = (((x + dst_clip_x - dst_region_x) * lin_ptr[x] = (((x + dst_clip_x - dst_region_x) *
(src_region_w)) / dst_region_w); (src_region_w)) / dst_region_w);
interp_x[x] = ((((x + dst_clip_x - dst_region_x) * if (src_region_w > 4096)
(src_region_w)) << 8) / dst_region_w) - interp_x[x] = (((((x + dst_clip_x - dst_region_x) *
(lin_ptr[x] << 8); (src_region_w)) << 6) / dst_region_w) -
(lin_ptr[x] << 6)) << 2;
else if (src_region_w > 2048)
interp_x[x] = (((((x + dst_clip_x - dst_region_x) *
(src_region_w)) << 7) / dst_region_w) -
(lin_ptr[x] << 7)) << 1;
else
interp_x[x] = (((((x + dst_clip_x - dst_region_x) *
(src_region_w)) << 8) / dst_region_w) -
(lin_ptr[x] << 8));
lin_ptr[x] += src_region_x; lin_ptr[x] += src_region_x;
} }
else else
@ -305,9 +314,18 @@ SCALE_FUNC(RGBA_Image *src, RGBA_Image *dst,
pos = (((y + dst_clip_y - dst_region_y) * pos = (((y + dst_clip_y - dst_region_y) *
(src_region_h)) / dst_region_h); (src_region_h)) / dst_region_h);
row_ptr[y] = src_data + ((pos + src_region_y) * src_w); row_ptr[y] = src_data + ((pos + src_region_y) * src_w);
interp_y[y] = ((((y + dst_clip_y - dst_region_y) * if (src_region_h > 4096)
(src_region_h)) << 8) / dst_region_h) - interp_y[y] = (((((y + dst_clip_y - dst_region_y) *
(pos << 8); (src_region_h)) << 6) / dst_region_h) -
(pos << 6)) << 2;
else if (src_region_h > 2048)
interp_y[y] = (((((y + dst_clip_y - dst_region_y) *
(src_region_h)) << 7) / dst_region_h) -
(pos << 7)) << 1;
else
interp_y[y] = (((((y + dst_clip_y - dst_region_y) *
(src_region_h)) << 8) / dst_region_h) -
(pos << 8));
} }
else else
{ {