Add scaleMode to SDL_SoftStretch(), remove SDL_SoftStretchLinear().

This commit is contained in:
Sylvain
2023-12-22 15:02:43 +01:00
committed by Sam Lantinga
parent 5dba04b29b
commit ffd82fb7c4
9 changed files with 39 additions and 48 deletions

View File

@@ -974,7 +974,7 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
if (!(src->map->info.flags & complex_copy_flags) &&
src->format->format == dst->format->format &&
!SDL_ISPIXELFORMAT_INDEXED(src->format->format)) {
return SDL_SoftStretch(src, srcrect, dst, dstrect);
return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST);
} else {
return SDL_BlitSurfaceUnchecked(src, srcrect, dst, dstrect);
}
@@ -985,7 +985,7 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
src->format->BytesPerPixel == 4 &&
src->format->format != SDL_PIXELFORMAT_ARGB2101010) {
/* fast path */
return SDL_SoftStretchLinear(src, srcrect, dst, dstrect);
return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR);
} else {
/* Use intermediate surface(s) */
SDL_Surface *tmp1 = NULL;
@@ -1035,7 +1035,7 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
if (is_complex_copy_flags || src->format->format != dst->format->format) {
SDL_Rect tmprect;
SDL_Surface *tmp2 = SDL_CreateSurface(dstrect->w, dstrect->h, src->format->format);
SDL_SoftStretchLinear(src, &srcrect2, tmp2, NULL);
SDL_SoftStretch(src, &srcrect2, tmp2, NULL, SDL_SCALEMODE_LINEAR);
SDL_SetSurfaceColorMod(tmp2, r, g, b);
SDL_SetSurfaceAlphaMod(tmp2, alpha);
@@ -1048,7 +1048,7 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
ret = SDL_BlitSurfaceUnchecked(tmp2, &tmprect, dst, dstrect);
SDL_DestroySurface(tmp2);
} else {
ret = SDL_SoftStretchLinear(src, &srcrect2, dst, dstrect);
ret = SDL_SoftStretch(src, &srcrect2, dst, dstrect, SDL_SCALEMODE_LINEAR);
}
SDL_DestroySurface(tmp1);