mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-25 22:19:10 +00:00
Renamed SDL_SoftStretch() to SDL_StretchSurface()
Fixes https://github.com/libsdl-org/SDL/issues/12168
This commit is contained in:
parent
f40ef62a2a
commit
8e51b2468a
12 changed files with 24 additions and 27 deletions
|
@ -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_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_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.
|
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_GetYUVConversionMode()
|
||||||
* SDL_GetYUVConversionModeForResolution()
|
* 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_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_SoftStretch() - use SDL_StretchSurface() with SDL_SCALEMODE_NEAREST
|
||||||
* SDL_SoftStretchLinear() - use SDL_BlitSurfaceScaled() with SDL_SCALEMODE_LINEAR
|
* SDL_SoftStretchLinear() - use SDL_StretchSurface() with SDL_SCALEMODE_LINEAR
|
||||||
|
|
||||||
The following symbols have been renamed:
|
The following symbols have been renamed:
|
||||||
* SDL_PREALLOC => SDL_SURFACE_PREALLOCATED
|
* SDL_PREALLOC => SDL_SURFACE_PREALLOCATED
|
||||||
|
|
|
@ -1194,7 +1194,7 @@ extern SDL_DECLSPEC bool SDLCALL SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src
|
||||||
*
|
*
|
||||||
* \sa SDL_BlitSurfaceScaled
|
* \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
|
* Perform a tiled blit to a destination surface, which may be of a different
|
||||||
|
|
|
@ -888,7 +888,7 @@ bool SDL_CameraThreadIterate(SDL_Camera *device)
|
||||||
SDL_Surface *srcsurf = acquired;
|
SDL_Surface *srcsurf = acquired;
|
||||||
if (device->needs_scaling == -1) { // downscaling? Do it first. -1: downscale, 0: no scaling, 1: upscale
|
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_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;
|
srcsurf = dstsurf;
|
||||||
}
|
}
|
||||||
if (device->needs_conversion) {
|
if (device->needs_conversion) {
|
||||||
|
@ -899,7 +899,7 @@ bool SDL_CameraThreadIterate(SDL_Camera *device)
|
||||||
srcsurf = dstsurf;
|
srcsurf = dstsurf;
|
||||||
}
|
}
|
||||||
if (device->needs_scaling == 1) { // upscaling? Do it last. -1: downscale, 0: no scaling, 1: upscale
|
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.
|
// we made a copy, so we can give the driver back its resources.
|
||||||
|
|
|
@ -1233,7 +1233,7 @@ SDL3_0.0.0 {
|
||||||
SDL_AudioStreamDevicePaused;
|
SDL_AudioStreamDevicePaused;
|
||||||
SDL_ClickTrayEntry;
|
SDL_ClickTrayEntry;
|
||||||
SDL_UpdateTrays;
|
SDL_UpdateTrays;
|
||||||
SDL_SoftStretch;
|
SDL_StretchSurface;
|
||||||
# extra symbols go here (don't modify this line)
|
# extra symbols go here (don't modify this line)
|
||||||
local: *;
|
local: *;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1258,4 +1258,4 @@
|
||||||
#define SDL_AudioStreamDevicePaused SDL_AudioStreamDevicePaused_REAL
|
#define SDL_AudioStreamDevicePaused SDL_AudioStreamDevicePaused_REAL
|
||||||
#define SDL_ClickTrayEntry SDL_ClickTrayEntry_REAL
|
#define SDL_ClickTrayEntry SDL_ClickTrayEntry_REAL
|
||||||
#define SDL_UpdateTrays SDL_UpdateTrays_REAL
|
#define SDL_UpdateTrays SDL_UpdateTrays_REAL
|
||||||
#define SDL_SoftStretch SDL_SoftStretch_REAL
|
#define SDL_StretchSurface SDL_StretchSurface_REAL
|
||||||
|
|
|
@ -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(bool,SDL_AudioStreamDevicePaused,(SDL_AudioStream *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(void,SDL_ClickTrayEntry,(SDL_TrayEntry *a),(a),)
|
SDL_DYNAPI_PROC(void,SDL_ClickTrayEntry,(SDL_TrayEntry *a),(a),)
|
||||||
SDL_DYNAPI_PROC(void,SDL_UpdateTrays,(void),(),)
|
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)
|
||||||
|
|
|
@ -385,7 +385,7 @@ bool SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture *swdata, const SDL_Rect *srcrect, SDL
|
||||||
}
|
}
|
||||||
if (stretch) {
|
if (stretch) {
|
||||||
SDL_Rect rect = *srcrect;
|
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 {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,10 +22,10 @@
|
||||||
|
|
||||||
#include "SDL_surface_c.h"
|
#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_StretchSurfaceUncheckedNearest(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_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;
|
bool result;
|
||||||
int src_locked;
|
int src_locked;
|
||||||
|
@ -46,7 +46,7 @@ bool SDL_SoftStretch(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surface *dst
|
||||||
if (!src_tmp) {
|
if (!src_tmp) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
result = SDL_SoftStretch(src_tmp, srcrect, dst, dstrect, scaleMode);
|
result = SDL_StretchSurface(src_tmp, srcrect, dst, dstrect, scaleMode);
|
||||||
SDL_DestroySurface(src_tmp);
|
SDL_DestroySurface(src_tmp);
|
||||||
return result;
|
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 *src_tmp = SDL_ConvertSurface(src, SDL_PIXELFORMAT_XRGB8888);
|
||||||
SDL_Surface *dst_tmp = SDL_CreateSurface(dstrect->w, dstrect->h, SDL_PIXELFORMAT_XRGB8888);
|
SDL_Surface *dst_tmp = SDL_CreateSurface(dstrect->w, dstrect->h, SDL_PIXELFORMAT_XRGB8888);
|
||||||
if (src_tmp && dst_tmp) {
|
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) {
|
if (result) {
|
||||||
result = SDL_ConvertPixelsAndColorspace(dstrect->w, dstrect->h,
|
result = SDL_ConvertPixelsAndColorspace(dstrect->w, dstrect->h,
|
||||||
dst_tmp->format, SDL_COLORSPACE_SRGB, 0,
|
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) {
|
if (scaleMode == SDL_SCALEMODE_NEAREST) {
|
||||||
result = SDL_LowerSoftStretchNearest(src, srcrect, dst, dstrect);
|
result = SDL_StretchSurfaceUncheckedNearest(src, srcrect, dst, dstrect);
|
||||||
} else {
|
} 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
|
// 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
|
#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;
|
bool result = false;
|
||||||
int src_w = srcrect->w;
|
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;
|
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_w = srcrect->w;
|
||||||
int src_h = srcrect->h;
|
int src_h = srcrect->h;
|
||||||
|
|
|
@ -1256,7 +1256,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S
|
||||||
src->format == dst->format &&
|
src->format == dst->format &&
|
||||||
!SDL_ISPIXELFORMAT_INDEXED(src->format) &&
|
!SDL_ISPIXELFORMAT_INDEXED(src->format) &&
|
||||||
SDL_BYTESPERPIXEL(src->format) <= 4) {
|
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) {
|
} else if (SDL_BITSPERPIXEL(src->format) < 8) {
|
||||||
// Scaling bitmap not yet supported, convert to RGBA for blit
|
// Scaling bitmap not yet supported, convert to RGBA for blit
|
||||||
bool result = false;
|
bool result = false;
|
||||||
|
@ -1276,7 +1276,7 @@ bool SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect, S
|
||||||
SDL_BYTESPERPIXEL(src->format) == 4 &&
|
SDL_BYTESPERPIXEL(src->format) == 4 &&
|
||||||
src->format != SDL_PIXELFORMAT_ARGB2101010) {
|
src->format != SDL_PIXELFORMAT_ARGB2101010) {
|
||||||
// fast path
|
// 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) {
|
} else if (SDL_BITSPERPIXEL(src->format) < 8) {
|
||||||
// Scaling bitmap not yet supported, convert to RGBA for blit
|
// Scaling bitmap not yet supported, convert to RGBA for blit
|
||||||
bool result = false;
|
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) {
|
if (is_complex_copy_flags || src->format != dst->format) {
|
||||||
SDL_Rect tmprect;
|
SDL_Rect tmprect;
|
||||||
SDL_Surface *tmp2 = SDL_CreateSurface(dstrect->w, dstrect->h, src->format);
|
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_SetSurfaceColorMod(tmp2, r, g, b);
|
||||||
SDL_SetSurfaceAlphaMod(tmp2, alpha);
|
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);
|
result = SDL_BlitSurfaceUnchecked(tmp2, &tmprect, dst, dstrect);
|
||||||
SDL_DestroySurface(tmp2);
|
SDL_DestroySurface(tmp2);
|
||||||
} else {
|
} else {
|
||||||
result = SDL_SoftStretch(src, &srcrect2, dst, dstrect, SDL_SCALEMODE_LINEAR);
|
result = SDL_StretchSurface(src, &srcrect2, dst, dstrect, SDL_SCALEMODE_LINEAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DestroySurface(tmp1);
|
SDL_DestroySurface(tmp1);
|
||||||
|
|
|
@ -88,6 +88,5 @@ extern float SDL_GetSurfaceSDRWhitePoint(SDL_Surface *surface, SDL_Colorspace co
|
||||||
extern float SDL_GetDefaultHDRHeadroom(SDL_Colorspace colorspace);
|
extern float SDL_GetDefaultHDRHeadroom(SDL_Colorspace colorspace);
|
||||||
extern float SDL_GetSurfaceHDRHeadroom(SDL_Surface *surface, 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 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_
|
#endif // SDL_surface_c_h_
|
||||||
|
|
|
@ -82,7 +82,7 @@ bool WIN_UpdateWindowShape(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surfa
|
||||||
if (!stretched) {
|
if (!stretched) {
|
||||||
return false;
|
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);
|
SDL_DestroySurface(stretched);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,7 +71,7 @@ bool X11_UpdateWindowShape(SDL_VideoDevice *_this, SDL_Window *window, SDL_Surfa
|
||||||
if (!stretched) {
|
if (!stretched) {
|
||||||
return false;
|
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);
|
SDL_DestroySurface(stretched);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue