diff --git a/docs/README-migration.md b/docs/README-migration.md index 750a1f0544..0cbe9fe3e4 100644 --- a/docs/README-migration.md +++ b/docs/README-migration.md @@ -1845,8 +1845,6 @@ SDL_BlitSurface() and SDL_BlitSurfaceScaled() now have a const `dstrect` paramet SDL_BlitSurfaceScaled() and SDL_BlitSurfaceUncheckedScaled() now take a scale parameter. -SDL_SoftStretch() now takes a scale parameter. - SDL_PixelFormat is used instead of Uint32 for API functions that refer to pixel format by enumerated value. SDL_SetSurfaceColorKey() takes an bool to enable and disable colorkey. RLE acceleration isn't controlled by the parameter, you should use SDL_SetSurfaceRLE() to change that separately. @@ -1880,8 +1878,8 @@ The following functions have been removed: * SDL_GetYUVConversionMode() * SDL_GetYUVConversionModeForResolution() * SDL_SetYUVConversionMode() - use SDL_SetSurfaceColorspace() to set the surface colorspace and SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER with SDL_CreateTextureWithProperties() to set the texture colorspace. The default colorspace for YUV pixel formats is SDL_COLORSPACE_JPEG. -* SDL_SoftStretch() - use SDL_BlitSurfaceScaled() with SDL_SCALEMODE_NEAREST -* SDL_SoftStretchLinear() - use SDL_BlitSurfaceScaled() with SDL_SCALEMODE_LINEAR +* SDL_SoftStretch() - use SDL_StretchSurface() with SDL_SCALEMODE_NEAREST +* SDL_SoftStretchLinear() - use SDL_StretchSurface() with SDL_SCALEMODE_LINEAR The following symbols have been renamed: * SDL_PREALLOC => SDL_SURFACE_PREALLOCATED diff --git a/include/SDL3/SDL_surface.h b/include/SDL3/SDL_surface.h index 6e28854c4a..59691c479e 100644 --- a/include/SDL3/SDL_surface.h +++ b/include/SDL3/SDL_surface.h @@ -1194,7 +1194,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src * * \sa SDL_BlitSurfaceScaled */ -extern SDL_DECLSPEC bool SDLCALL SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); +extern SDL_DECLSPEC bool SDLCALL SDL_StretchSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); /** * Perform a tiled blit to a destination surface, which may be of a different diff --git a/src/camera/SDL_camera.c b/src/camera/SDL_camera.c index 142709f9a6..1849d04e8c 100644 --- a/src/camera/SDL_camera.c +++ b/src/camera/SDL_camera.c @@ -888,7 +888,7 @@ bool SDL_CameraThreadIterate(SDL_Camera *device) SDL_Surface *srcsurf = acquired; if (device->needs_scaling == -1) { // downscaling? Do it first. -1: downscale, 0: no scaling, 1: upscale SDL_Surface *dstsurf = device->needs_conversion ? device->conversion_surface : output_surface; - SDL_SoftStretch(srcsurf, NULL, dstsurf, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? + SDL_StretchSurface(srcsurf, NULL, dstsurf, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? srcsurf = dstsurf; } if (device->needs_conversion) { @@ -899,7 +899,7 @@ bool SDL_CameraThreadIterate(SDL_Camera *device) srcsurf = dstsurf; } if (device->needs_scaling == 1) { // upscaling? Do it last. -1: downscale, 0: no scaling, 1: upscale - SDL_SoftStretch(srcsurf, NULL, output_surface, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? + SDL_StretchSurface(srcsurf, NULL, output_surface, NULL, SDL_SCALEMODE_NEAREST); // !!! FIXME: linear scale? letterboxing? } // we made a copy, so we can give the driver back its resources. diff --git a/src/dynapi/SDL_dynapi.sym b/src/dynapi/SDL_dynapi.sym index 9c7621b806..73f34843d8 100644 --- a/src/dynapi/SDL_dynapi.sym +++ b/src/dynapi/SDL_dynapi.sym @@ -1233,7 +1233,7 @@ SDL3_0.0.0 { SDL_AudioStreamDevicePaused; SDL_ClickTrayEntry; SDL_UpdateTrays; - SDL_SoftStretch; + SDL_StretchSurface; # extra symbols go here (don't modify this line) local: *; }; diff --git a/src/dynapi/SDL_dynapi_overrides.h b/src/dynapi/SDL_dynapi_overrides.h index 27051a8c04..77fd553c47 100644 --- a/src/dynapi/SDL_dynapi_overrides.h +++ b/src/dynapi/SDL_dynapi_overrides.h @@ -1258,4 +1258,4 @@ #define SDL_AudioStreamDevicePaused SDL_AudioStreamDevicePaused_REAL #define SDL_ClickTrayEntry SDL_ClickTrayEntry_REAL #define SDL_UpdateTrays SDL_UpdateTrays_REAL -#define SDL_SoftStretch SDL_SoftStretch_REAL +#define SDL_StretchSurface SDL_StretchSurface_REAL diff --git a/src/dynapi/SDL_dynapi_procs.h b/src/dynapi/SDL_dynapi_procs.h index df98958d78..e86ac2a325 100644 --- a/src/dynapi/SDL_dynapi_procs.h +++ b/src/dynapi/SDL_dynapi_procs.h @@ -1266,4 +1266,4 @@ SDL_DYNAPI_PROC(SDL_ThreadState,SDL_GetThreadState,(SDL_Thread *a),(a),return) SDL_DYNAPI_PROC(bool,SDL_AudioStreamDevicePaused,(SDL_AudioStream *a),(a),return) SDL_DYNAPI_PROC(void,SDL_ClickTrayEntry,(SDL_TrayEntry *a),(a),) SDL_DYNAPI_PROC(void,SDL_UpdateTrays,(void),(),) -SDL_DYNAPI_PROC(bool,SDL_SoftStretch,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c,const SDL_Rect *d,SDL_ScaleMode e),(a,b,c,d,e),return) +SDL_DYNAPI_PROC(bool,SDL_StretchSurface,(SDL_Surface *a,const SDL_Rect *b,SDL_Surface *c,const SDL_Rect *d,SDL_ScaleMode e),(a,b,c,d,e),return) diff --git a/src/render/SDL_yuv_sw.c b/src/render/SDL_yuv_sw.c index 64250de323..abe9e16212 100644 --- a/src/render/SDL_yuv_sw.c +++ b/src/render/SDL_yuv_sw.c @@ -385,7 +385,7 @@ bool SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect, SDL } if (stretch) { SDL_Rect rect = *srcrect; - return SDL_SoftStretch(swdata->stretch, &rect, swdata->display, NULL, SDL_SCALEMODE_NEAREST); + return SDL_StretchSurface(swdata->stretch, &rect, swdata->display, NULL, SDL_SCALEMODE_NEAREST); } else { return true; } diff --git a/src/video/SDL_stretch.c b/src/video/SDL_stretch.c index acdc63bd16..c893cc3459 100644 --- a/src/video/SDL_stretch.c +++ b/src/video/SDL_stretch.c @@ -22,10 +22,10 @@ #include "SDL_surface_c.h" -static bool SDL_LowerSoftStretchNearest(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); -static bool SDL_LowerSoftStretchLinear(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); +static bool SDL_StretchSurfaceUncheckedNearest(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); +static bool SDL_StretchSurfaceUncheckedLinear(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect); -bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode) +bool SDL_StretchSurface(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode) { bool result; int src_locked; @@ -46,7 +46,7 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst if (!src_tmp) { return false; } - result = SDL_SoftStretch(src_tmp, srcrect, dst, dstrect, scaleMode); + result = SDL_StretchSurface(src_tmp, srcrect, dst, dstrect, scaleMode); SDL_DestroySurface(src_tmp); return result; } @@ -64,7 +64,7 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst SDL_Surface *src_tmp = SDL_ConvertSurface(src, SDL_PIXELFORMAT_XRGB8888); SDL_Surface *dst_tmp = SDL_CreateSurface(dstrect->w, dstrect->h, SDL_PIXELFORMAT_XRGB8888); if (src_tmp && dst_tmp) { - result = SDL_SoftStretch(src_tmp, srcrect, dst_tmp, NULL, scaleMode); + result = SDL_StretchSurface(src_tmp, srcrect, dst_tmp, NULL, scaleMode); if (result) { result = SDL_ConvertPixelsAndColorspace(dstrect->w, dstrect->h, dst_tmp->format, SDL_COLORSPACE_SRGB, 0, @@ -152,9 +152,9 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst } if (scaleMode == SDL_SCALEMODE_NEAREST) { - result = SDL_LowerSoftStretchNearest(src, srcrect, dst, dstrect); + result = SDL_StretchSurfaceUncheckedNearest(src, srcrect, dst, dstrect); } else { - result = SDL_LowerSoftStretchLinear(src, srcrect, dst, dstrect); + result = SDL_StretchSurfaceUncheckedLinear(src, srcrect, dst, dstrect); } // We need to unlock the surfaces if they're locked @@ -825,7 +825,7 @@ static bool scale_mat_NEON(const Uint32 *src, int src_w, int src_h, int src_pitc } #endif -bool SDL_LowerSoftStretchLinear(SDL_Surface *s, const SDL_Rect *srcrect, SDL_Surface *d, const SDL_Rect *dstrect) +bool SDL_StretchSurfaceUncheckedLinear(SDL_Surface *s, const SDL_Rect *srcrect, SDL_Surface *d, const SDL_Rect *dstrect) { bool result = false; int src_w = srcrect->w; @@ -953,7 +953,7 @@ static bool scale_mat_nearest_4(const Uint32 *src_ptr, int src_w, int src_h, int return true; } -bool SDL_LowerSoftStretchNearest(SDL_Surface *s, const SDL_Rect *srcrect, SDL_Surface *d, const SDL_Rect *dstrect) +bool SDL_StretchSurfaceUncheckedNearest(SDL_Surface *s, const SDL_Rect *srcrect, SDL_Surface *d, const SDL_Rect *dstrect) { int src_w = srcrect->w; int src_h = srcrect->h; diff --git a/src/video/SDL_surface.c b/src/video/SDL_surface.c index 84db8bb44f..d8f831c208 100644 --- a/src/video/SDL_surface.c +++ b/src/video/SDL_surface.c @@ -1256,7 +1256,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S src->format == dst->format && !SDL_ISPIXELFORMAT_INDEXED(src->format) && SDL_BYTESPERPIXEL(src->format) <= 4) { - return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); + return SDL_StretchSurface(src, srcrect, dst, dstrect, SDL_SCALEMODE_NEAREST); } else if (SDL_BITSPERPIXEL(src->format) < 8) { // Scaling bitmap not yet supported, convert to RGBA for blit bool result = false; @@ -1276,7 +1276,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S SDL_BYTESPERPIXEL(src->format) == 4 && src->format != SDL_PIXELFORMAT_ARGB2101010) { // fast path - return SDL_SoftStretch(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR); + return SDL_StretchSurface(src, srcrect, dst, dstrect, SDL_SCALEMODE_LINEAR); } else if (SDL_BITSPERPIXEL(src->format) < 8) { // Scaling bitmap not yet supported, convert to RGBA for blit bool result = false; @@ -1335,7 +1335,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S if (is_complex_copy_flags || src->format != dst->format) { SDL_Rect tmprect; SDL_Surface *tmp2 = SDL_CreateSurface(dstrect->w, dstrect->h, src->format); - SDL_SoftStretch(src, &srcrect2, tmp2, NULL, SDL_SCALEMODE_LINEAR); + SDL_StretchSurface(src, &srcrect2, tmp2, NULL, SDL_SCALEMODE_LINEAR); SDL_SetSurfaceColorMod(tmp2, r, g, b); SDL_SetSurfaceAlphaMod(tmp2, alpha); @@ -1348,7 +1348,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S result = SDL_BlitSurfaceUnchecked(tmp2, &tmprect, dst, dstrect); SDL_DestroySurface(tmp2); } else { - result = SDL_SoftStretch(src, &srcrect2, dst, dstrect, SDL_SCALEMODE_LINEAR); + result = SDL_StretchSurface(src, &srcrect2, dst, dstrect, SDL_SCALEMODE_LINEAR); } SDL_DestroySurface(tmp1); diff --git a/src/video/SDL_surface_c.h b/src/video/SDL_surface_c.h index 1dc430f541..27dc88a625 100644 --- a/src/video/SDL_surface_c.h +++ b/src/video/SDL_surface_c.h @@ -88,6 +88,5 @@ extern float SDL_GetSurfaceSDRWhitePoint(SDL_Surface *surface, SDL_Colorspace co extern float SDL_GetDefaultHDRHeadroom(SDL_Colorspace colorspace); extern float SDL_GetSurfaceHDRHeadroom(SDL_Surface *surface, SDL_Colorspace colorspace); extern SDL_Surface *SDL_GetSurfaceImage(SDL_Surface *surface, float display_scale); -extern bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst, const SDL_Rect *dstrect, SDL_ScaleMode scaleMode); #endif // SDL_surface_c_h_ diff --git a/src/video/windows/SDL_windowsshape.c b/src/video/windows/SDL_windowsshape.c index ae6b951061..2c3f1cc2b6 100644 --- a/src/video/windows/SDL_windowsshape.c +++ b/src/video/windows/SDL_windowsshape.c @@ -82,7 +82,7 @@ bool WIN_UpdateWindowShape(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surfa if (!stretched) { return false; } - if (!SDL_SoftStretch(shape, NULL, stretched, NULL, SDL_SCALEMODE_LINEAR)) { + if (!SDL_StretchSurface(shape, NULL, stretched, NULL, SDL_SCALEMODE_LINEAR)) { SDL_DestroySurface(stretched); return false; } diff --git a/src/video/x11/SDL_x11shape.c b/src/video/x11/SDL_x11shape.c index 710eb3299f..92c44f96ee 100644 --- a/src/video/x11/SDL_x11shape.c +++ b/src/video/x11/SDL_x11shape.c @@ -71,7 +71,7 @@ bool X11_UpdateWindowShape(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surfa if (!stretched) { return false; } - if (!SDL_SoftStretch(shape, NULL, stretched, NULL, SDL_SCALEMODE_LINEAR)) { + if (!SDL_StretchSurface(shape, NULL, stretched, NULL, SDL_SCALEMODE_LINEAR)) { SDL_DestroySurface(stretched); return false; }