Fixed bug 5510 - simplify the scaling functions

This commit is contained in:
Sylvain Becker 2021-01-28 15:33:47 +01:00
parent dd6e02df63
commit 0b338bffe6
2 changed files with 11 additions and 31 deletions

View File

@ -40,7 +40,7 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
Uint32 dstpixel; Uint32 dstpixel;
Uint32 dstR, dstG, dstB, dstA; Uint32 dstR, dstG, dstB, dstA;
int srcy, srcx; int srcy, srcx;
int posy, posx; Uint32 posy, posx;
int incy, incx; int incy, incx;
SDL_PixelFormat *src_fmt = info->src_fmt; SDL_PixelFormat *src_fmt = info->src_fmt;
SDL_PixelFormat *dst_fmt = info->dst_fmt; SDL_PixelFormat *dst_fmt = info->dst_fmt;
@ -49,7 +49,6 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
Uint32 rgbmask = ~src_fmt->Amask; Uint32 rgbmask = ~src_fmt->Amask;
Uint32 ckey = info->colorkey & rgbmask; Uint32 ckey = info->colorkey & rgbmask;
srcy = 0;
posy = 0; posy = 0;
incy = (info->src_h << 16) / info->dst_h; incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w; incx = (info->src_w << 16) / info->dst_w;
@ -58,21 +57,11 @@ SDL_Blit_Slow(SDL_BlitInfo * info)
Uint8 *src = 0; Uint8 *src = 0;
Uint8 *dst = info->dst; Uint8 *dst = info->dst;
int n = info->dst_w; int n = info->dst_w;
srcx = -1; posx = 0;
posx = 0x10000L; srcy = posy >> 16;
while (posy >= 0x10000L) {
++srcy;
posy -= 0x10000L;
}
while (n--) { while (n--) {
if (posx >= 0x10000L) { srcx = posx >> 16;
while (posx >= 0x10000L) { src = (info->src + (srcy * info->src_pitch) + (srcx * srcbpp));
++srcx;
posx -= 0x10000L;
}
src =
(info->src + (srcy * info->src_pitch) + (srcx * srcbpp));
}
if (src_fmt->Amask) { if (src_fmt->Amask) {
DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG, DISEMBLE_RGBA(src, srcbpp, src_fmt, srcpixel, srcR, srcG,
srcB, srcA); srcB, srcA);

View File

@ -452,13 +452,12 @@ __EOF__
if ( $scale ) { if ( $scale ) {
print FILE <<__EOF__; print FILE <<__EOF__;
int srcy, srcx; int srcy, srcx;
int posy, posx; Uint32 posy, posx;
int incy, incx; int incy, incx;
__EOF__ __EOF__
print FILE <<__EOF__; print FILE <<__EOF__;
srcy = 0;
posy = 0; posy = 0;
incy = (info->src_h << 16) / info->dst_h; incy = (info->src_h << 16) / info->dst_h;
incx = (info->src_w << 16) / info->dst_w; incx = (info->src_w << 16) / info->dst_w;
@ -467,22 +466,14 @@ __EOF__
$format_type{$src} *src = 0; $format_type{$src} *src = 0;
$format_type{$dst} *dst = ($format_type{$dst} *)info->dst; $format_type{$dst} *dst = ($format_type{$dst} *)info->dst;
int n = info->dst_w; int n = info->dst_w;
srcx = -1; posx = 0;
posx = 0x10000L;
while (posy >= 0x10000L) { srcy = posy >> 16;
++srcy;
posy -= 0x10000L;
}
while (n--) { while (n--) {
if (posx >= 0x10000L) { srcx = posx >> 16;
while (posx >= 0x10000L) { src = ($format_type{$src} *)(info->src + (srcy * info->src_pitch) + (srcx * $format_size{$src}));
++srcx;
posx -= 0x10000L;
}
src = ($format_type{$src} *)(info->src + (srcy * info->src_pitch) + (srcx * $format_size{$src}));
__EOF__ __EOF__
print FILE <<__EOF__; print FILE <<__EOF__;
}
__EOF__ __EOF__
output_copycore($src, $dst, $modulate, $blend, $is_modulateA_done, $A_is_const_FF); output_copycore($src, $dst, $modulate, $blend, $is_modulateA_done, $A_is_const_FF);
print FILE <<__EOF__; print FILE <<__EOF__;