From f7ab765b8418f31044aa9979e4d0bf267a904db0 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Fri, 19 Jan 2024 13:06:12 -0800 Subject: [PATCH] Fixed crash scaling very large surfaces Fixes https://github.com/libsdl-org/SDL/issues/8878 (cherry picked from commit 09ba55b462b826070482a586b72906fae4a66b32) --- src/video/SDL_blit_auto.c | 720 +++++++++++++++++++------------------- src/video/SDL_blit_slow.c | 10 +- src/video/SDL_stretch.c | 33 +- src/video/sdlgenblit.pl | 10 +- 4 files changed, 387 insertions(+), 386 deletions(-) diff --git a/src/video/SDL_blit_auto.c b/src/video/SDL_blit_auto.c index 5ec0bd1171..b05dc4a02e 100644 --- a/src/video/SDL_blit_auto.c +++ b/src/video/SDL_blit_auto.c @@ -31,12 +31,12 @@ static void SDL_Blit_RGB888_RGB888_Scale(SDL_BlitInfo *info) { - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -114,12 +114,12 @@ static void SDL_Blit_RGB888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -207,12 +207,12 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -321,12 +321,12 @@ static void SDL_Blit_RGB888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -392,12 +392,12 @@ static void SDL_Blit_RGB888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -478,12 +478,12 @@ static void SDL_Blit_RGB888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -571,12 +571,12 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -685,12 +685,12 @@ static void SDL_Blit_RGB888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -756,12 +756,12 @@ static void SDL_Blit_RGB888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; const Uint32 A = 0xFF; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -842,12 +842,12 @@ static void SDL_Blit_RGB888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -940,12 +940,12 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) Uint32 pixel; const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1055,12 +1055,12 @@ static void SDL_Blit_RGB888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1127,12 +1127,12 @@ static void SDL_Blit_BGR888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1213,12 +1213,12 @@ static void SDL_Blit_BGR888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1306,12 +1306,12 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1420,12 +1420,12 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1489,12 +1489,12 @@ static void SDL_Blit_BGR888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_BGR888_BGR888_Scale(SDL_BlitInfo *info) { - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1572,12 +1572,12 @@ static void SDL_Blit_BGR888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1665,12 +1665,12 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1779,12 +1779,12 @@ static void SDL_Blit_BGR888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1851,12 +1851,12 @@ static void SDL_Blit_BGR888_ARGB8888_Scale(SDL_BlitInfo *info) Uint32 pixel; const Uint32 A = 0xFF; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -1938,12 +1938,12 @@ static void SDL_Blit_BGR888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2036,12 +2036,12 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) Uint32 pixel; const Uint32 A = (flags & SDL_COPY_MODULATE_ALPHA) ? modulateA : 0xFF; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2151,12 +2151,12 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2222,12 +2222,12 @@ static void SDL_Blit_BGR888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ARGB8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2315,12 +2315,12 @@ static void SDL_Blit_ARGB8888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2416,12 +2416,12 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2531,12 +2531,12 @@ static void SDL_Blit_ARGB8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2605,12 +2605,12 @@ static void SDL_Blit_ARGB8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2699,12 +2699,12 @@ static void SDL_Blit_ARGB8888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2800,12 +2800,12 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2915,12 +2915,12 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -2987,12 +2987,12 @@ static void SDL_Blit_ARGB8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ARGB8888_ARGB8888_Scale(SDL_BlitInfo *info) { - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3079,12 +3079,12 @@ static void SDL_Blit_ARGB8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3186,12 +3186,12 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateA = info->a; Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3305,12 +3305,12 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3379,12 +3379,12 @@ static void SDL_Blit_ARGB8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_RGBA8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3472,12 +3472,12 @@ static void SDL_Blit_RGBA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3573,12 +3573,12 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3688,12 +3688,12 @@ static void SDL_Blit_RGBA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3762,12 +3762,12 @@ static void SDL_Blit_RGBA8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3856,12 +3856,12 @@ static void SDL_Blit_RGBA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -3957,12 +3957,12 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4072,12 +4072,12 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4145,12 +4145,12 @@ static void SDL_Blit_RGBA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_RGBA8888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4239,12 +4239,12 @@ static void SDL_Blit_RGBA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4346,12 +4346,12 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateA = info->a; Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4465,12 +4465,12 @@ static void SDL_Blit_RGBA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4540,12 +4540,12 @@ static void SDL_Blit_ABGR8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4634,12 +4634,12 @@ static void SDL_Blit_ABGR8888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4735,12 +4735,12 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4850,12 +4850,12 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -4923,12 +4923,12 @@ static void SDL_Blit_ABGR8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_ABGR8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5016,12 +5016,12 @@ static void SDL_Blit_ABGR8888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5117,12 +5117,12 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5232,12 +5232,12 @@ static void SDL_Blit_ABGR8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5306,12 +5306,12 @@ static void SDL_Blit_ABGR8888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5401,12 +5401,12 @@ static void SDL_Blit_ABGR8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5508,12 +5508,12 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateA = info->a; Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5627,12 +5627,12 @@ static void SDL_Blit_ABGR8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5702,12 +5702,12 @@ static void SDL_Blit_BGRA8888_RGB888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5796,12 +5796,12 @@ static void SDL_Blit_BGRA8888_RGB888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -5897,12 +5897,12 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6012,12 +6012,12 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6085,12 +6085,12 @@ static void SDL_Blit_BGRA8888_RGB888_Modulate_Blend_Scale(SDL_BlitInfo *info) static void SDL_Blit_BGRA8888_BGR888_Scale(SDL_BlitInfo *info) { Uint32 pixel; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6178,12 +6178,12 @@ static void SDL_Blit_BGRA8888_BGR888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6279,12 +6279,12 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateB = info->b; Uint32 pixel; Uint32 R, G, B; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6394,12 +6394,12 @@ static void SDL_Blit_BGRA8888_BGR888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6468,12 +6468,12 @@ static void SDL_Blit_BGRA8888_ARGB8888_Scale(SDL_BlitInfo *info) { Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6563,12 +6563,12 @@ static void SDL_Blit_BGRA8888_ARGB8888_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6670,12 +6670,12 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Scale(SDL_BlitInfo *info) const Uint32 modulateA = info->a; Uint32 pixel; Uint32 R, G, B, A; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { @@ -6789,12 +6789,12 @@ static void SDL_Blit_BGRA8888_ARGB8888_Modulate_Blend_Scale(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) { diff --git a/src/video/SDL_blit_slow.c b/src/video/SDL_blit_slow.c index e3710aa660..7696dcf925 100644 --- a/src/video/SDL_blit_slow.c +++ b/src/video/SDL_blit_slow.c @@ -54,9 +54,9 @@ void SDL_Blit_Slow(SDL_BlitInfo *info) Uint32 srcR, srcG, srcB, srcA; Uint32 dstpixel; Uint32 dstR, dstG, dstB, dstA; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; SDL_PixelFormat *src_fmt = info->src_fmt; SDL_PixelFormat *dst_fmt = info->dst_fmt; int srcbpp = src_fmt->BytesPerPixel; @@ -69,8 +69,8 @@ void SDL_Blit_Slow(SDL_BlitInfo *info) srcfmt_val = detect_format(src_fmt); dstfmt_val = detect_format(dst_fmt); - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; /* start at the middle of pixel */ while (info->dst_h--) { diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index 1df851ce5f..2de77f58d1 100644 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -163,7 +163,8 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, #define BILINEAR___HEIGHT \ int index_h, frac_h0, frac_h1, middle; \ const Uint32 *src_h0, *src_h1; \ - int no_padding, incr_h0, incr_h1; \ + int no_padding; \ + Uint64 incr_h0, incr_h1; \ \ no_padding = !(i < left_pad_h || i > dst_h - 1 - right_pad_h); \ index_h = SRC_INDEX(fp_sum_h); \ @@ -172,7 +173,7 @@ static int SDL_UpperSoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, index_h = no_padding ? index_h : (i < left_pad_h ? 0 : src_h - 1); \ frac_h0 = no_padding ? frac_h0 : 0; \ incr_h1 = no_padding ? src_pitch : 0; \ - incr_h0 = index_h * src_pitch; \ + incr_h0 = (Uint64)index_h * src_pitch; \ \ src_h0 = (const Uint32 *)((const Uint8 *)src + incr_h0); \ src_h1 = (const Uint32 *)((const Uint8 *)src_h0 + incr_h1); \ @@ -824,16 +825,16 @@ int SDL_LowerSoftStretchLinear(SDL_Surface *s, const SDL_Rect *srcrect, return ret; } -#define SDL_SCALE_NEAREST__START \ - int i; \ - Uint32 posy, incy; \ - Uint32 posx, incx; \ - int dst_gap; \ - int srcy, n; \ - const Uint32 *src_h0; \ - incy = (src_h << 16) / dst_h; \ - incx = (src_w << 16) / dst_w; \ - dst_gap = dst_pitch - bpp * dst_w; \ +#define SDL_SCALE_NEAREST__START \ + int i; \ + Uint64 posy, incy; \ + Uint64 posx, incx; \ + Uint64 srcy, srcx; \ + int dst_gap, n; \ + const Uint32 *src_h0; \ + incy = ((Uint64)src_h << 16) / dst_h; \ + incx = ((Uint64)src_w << 16) / dst_w; \ + dst_gap = dst_pitch - bpp * dst_w; \ posy = incy / 2; #define SDL_SCALE_NEAREST__HEIGHT \ @@ -852,7 +853,7 @@ static int scale_mat_nearest_1(const Uint32 *src_ptr, int src_w, int src_h, int SDL_SCALE_NEAREST__HEIGHT while (n--) { const Uint8 *src; - int srcx = bpp * (posx >> 16); + srcx = bpp * (posx >> 16); posx += incx; src = (const Uint8 *)src_h0 + srcx; *(Uint8 *)dst = *src; @@ -872,7 +873,7 @@ static int scale_mat_nearest_2(const Uint32 *src_ptr, int src_w, int src_h, int SDL_SCALE_NEAREST__HEIGHT while (n--) { const Uint16 *src; - int srcx = bpp * (posx >> 16); + srcx = bpp * (posx >> 16); posx += incx; src = (const Uint16 *)((const Uint8 *)src_h0 + srcx); *(Uint16 *)dst = *src; @@ -892,7 +893,7 @@ static int scale_mat_nearest_3(const Uint32 *src_ptr, int src_w, int src_h, int SDL_SCALE_NEAREST__HEIGHT while (n--) { const Uint8 *src; - int srcx = bpp * (posx >> 16); + srcx = bpp * (posx >> 16); posx += incx; src = (const Uint8 *)src_h0 + srcx; ((Uint8 *)dst)[0] = src[0]; @@ -914,7 +915,7 @@ static int scale_mat_nearest_4(const Uint32 *src_ptr, int src_w, int src_h, int SDL_SCALE_NEAREST__HEIGHT while (n--) { const Uint32 *src; - int srcx = bpp * (posx >> 16); + srcx = bpp * (posx >> 16); posx += incx; src = (const Uint32 *)((const Uint8 *)src_h0 + srcx); *dst = *src; diff --git a/src/video/sdlgenblit.pl b/src/video/sdlgenblit.pl index c46d7b08ad..4afef7a0d0 100755 --- a/src/video/sdlgenblit.pl +++ b/src/video/sdlgenblit.pl @@ -518,15 +518,15 @@ __EOF__ } if ( $scale ) { print FILE <<__EOF__; - int srcy, srcx; - Uint32 posy, posx; - int incy, incx; + Uint64 srcy, srcx; + Uint64 posy, posx; + Uint64 incy, incx; __EOF__ print FILE <<__EOF__; - incy = (info->src_h << 16) / info->dst_h; - incx = (info->src_w << 16) / info->dst_w; + incy = ((Uint64)info->src_h << 16) / info->dst_h; + incx = ((Uint64)info->src_w << 16) / info->dst_w; posy = incy / 2; while (info->dst_h--) {