Remove depth field from SDL_CreateRGBSurfaceWithFormat and SDL_Create… (#6685)

* Remove depth field from SDL_CreateRGBSurfaceWithFormat and SDL_CreateRGBSurfaceWithFormatFrom
* Removed unused 'flags' parameter from SDL_CreateRGBSurface and SDL_CreateRGBSurfaceWithFormat
* Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat
main
Sylvain Becker 2022-11-29 18:40:09 +01:00 committed by GitHub
parent 6873082c34
commit fc4fc5295f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 95 additions and 109 deletions

View File

@ -25,3 +25,7 @@ General:
* SDL_HINT_VIDEO_X11_XINERAMA
* SDL_HINT_VIDEO_X11_XVIDMODE
* SDL_stdinc.h no longer includes stdio.h, stdlib.h, etc., it only provides the SDL C runtime functionality
* Removed unused 'depth' parameter from SDL_CreateRGBSurfaceWithFormat and SDL_CreateRGBSurfaceWithFormatFrom
* Removed unused 'flags' parameter from SDL_CreateRGBSurface and SDL_CreateRGBSurfaceWithFormat
* Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat

View File

@ -343,7 +343,7 @@ initializeTexture()
&Bmask, &Amask);
/* Create surface that will hold pixels passed into OpenGL */
bmp_surface_rgba8888 =
SDL_CreateRGBSurface(0, bmp_surface->w, bmp_surface->h, bpp, Rmask,
SDL_CreateRGBSurface(bmp_surface->w, bmp_surface->h, bpp, Rmask,
Gmask, Bmask, Amask);
/* Blit to this surface, effectively converting the format */
SDL_BlitSurface(bmp_surface, NULL, bmp_surface_rgba8888, NULL);

View File

@ -178,7 +178,7 @@ loadFont(void)
SDL_PixelFormatEnumToMasks(format, &bpp, &Rmask, &Gmask, &Bmask,
&Amask);
SDL_Surface *converted =
SDL_CreateRGBSurface(0, surface->w, surface->h, bpp, Rmask, Gmask,
SDL_CreateRGBSurface(surface->w, surface->h, bpp, Rmask, Gmask,
Bmask, Amask);
SDL_BlitSurface(surface, NULL, converted, NULL);
/* create our texture */

View File

@ -160,6 +160,13 @@ The standard C headers like stdio.h and stdlib.h are no longer included, you sho
M_PI is no longer defined in SDL_stdinc.h, you can use the new symbols SDL_PI_D (double) and SDL_PI_F (float) instead.
## SDL_surface.h
Removed unused 'depth' parameter from SDL_CreateRGBSurfaceWithFormat() and SDL_CreateRGBSurfaceWithFormatFrom()
Removed unused 'flags' parameter from SDL_CreateRGBSurface() and SDL_CreateRGBSurfaceWithFormat()
Removed unused 'flags' parameter from SDL_ConvertSurface and SDL_ConvertSurfaceFormat
## SDL_syswm.h
This header no longer includes platform specific headers and type definitions, instead allowing you to include the ones appropriate for your use case. You should define one or more of the following to enable the relevant platform-specific support:

View File

@ -140,7 +140,6 @@ typedef enum
* You can change this by calling SDL_SetSurfaceBlendMode() and selecting a
* different `blendMode`.
*
* \param flags the flags are unused and should be set to 0
* \param width the width of the surface
* \param height the height of the surface
* \param depth the depth of the surface in bits
@ -158,12 +157,10 @@ typedef enum
* \sa SDL_FreeSurface
*/
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
(Uint32 flags, int width, int height, int depth,
(int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
/**
* Allocate a new RGB surface with a specific pixel format.
*
@ -171,10 +168,8 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
* of providing pixel color masks, you provide it with a predefined format
* from SDL_PixelFormatEnum.
*
* \param flags the flags are unused and should be set to 0
* \param width the width of the surface
* \param height the height of the surface
* \param depth the depth of the surface in bits
* \param format the SDL_PixelFormatEnum for the new surface's pixel format.
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
@ -186,7 +181,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurface
* \sa SDL_FreeSurface
*/
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormat
(Uint32 flags, int width, int height, int depth, Uint32 format);
(int width, int height, Uint32 format);
/**
* Allocate a new RGB surface with existing pixel data.
@ -226,8 +221,6 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
Uint32 Bmask,
Uint32 Amask);
/* !!! FIXME for 2.1: why does this ask for depth? Format provides that. */
/**
* Allocate a new RGB surface with with a specific pixel format and existing
* pixel data.
@ -242,7 +235,6 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
* \param pixels a pointer to existing pixel data
* \param width the width of the surface
* \param height the height of the surface
* \param depth the depth of the surface in bits
* \param pitch the pitch of the surface in bytes
* \param format the SDL_PixelFormatEnum for the new surface's pixel format.
* \returns the new SDL_Surface structure that is created or NULL if it fails;
@ -255,7 +247,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceFrom(void *pixels,
* \sa SDL_FreeSurface
*/
extern DECLSPEC SDL_Surface *SDLCALL SDL_CreateRGBSurfaceWithFormatFrom
(void *pixels, int width, int height, int depth, int pitch, Uint32 format);
(void *pixels, int width, int height, int pitch, Uint32 format);
/**
* Free an RGB surface.
@ -661,8 +653,6 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface)
* \param src the existing SDL_Surface structure to convert
* \param fmt the SDL_PixelFormat structure that the new surface is optimized
* for
* \param flags the flags are unused and should be set to 0; this is a
* leftover from SDL 1.2's API
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
*
@ -673,7 +663,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_DuplicateSurface(SDL_Surface * surface)
* \sa SDL_CreateRGBSurface
*/
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
(SDL_Surface * src, const SDL_PixelFormat * fmt, Uint32 flags);
(SDL_Surface * src, const SDL_PixelFormat * fmt);
/**
* Copy an existing surface to a new surface of the specified format enum.
@ -686,8 +676,6 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
* \param src the existing SDL_Surface structure to convert
* \param pixel_format the SDL_PixelFormatEnum that the new surface is
* optimized for
* \param flags the flags are unused and should be set to 0; this is a
* leftover from SDL 1.2's API
* \returns the new SDL_Surface structure that is created or NULL if it fails;
* call SDL_GetError() for more information.
*
@ -698,7 +686,7 @@ extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurface
* \sa SDL_CreateRGBSurface
*/
extern DECLSPEC SDL_Surface *SDLCALL SDL_ConvertSurfaceFormat
(SDL_Surface * src, Uint32 pixel_format, Uint32 flags);
(SDL_Surface * src, Uint32 pixel_format);
/**
* Copy a block of pixels of one format to another format.

View File

@ -464,7 +464,7 @@ SDL_DYNAPI_PROC(SDL_iconv_t,SDL_iconv_open,(const char *a, const char *b),(a,b),
SDL_DYNAPI_PROC(int,SDL_iconv_close,(SDL_iconv_t a),(a),return)
SDL_DYNAPI_PROC(size_t,SDL_iconv,(SDL_iconv_t a, const char **b, size_t *c, char **d, size_t *e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(char*,SDL_iconv_string,(const char *a, const char *b, const char *c, size_t d),(a,b,c,d),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurface,(Uint32 a, int b, int c, int d, Uint32 e, Uint32 f, Uint32 g, Uint32 h),(a,b,c,d,e,f,g,h),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurface,(int a, int b, int c, Uint32 d, Uint32 e, Uint32 f, Uint32 g),(a,b,c,d,e,f,g),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceFrom,(void *a, int b, int c, int d, int e, Uint32 f, Uint32 g, Uint32 h, Uint32 i),(a,b,c,d,e,f,g,h,i),return)
SDL_DYNAPI_PROC(void,SDL_FreeSurface,(SDL_Surface *a),(a),)
SDL_DYNAPI_PROC(int,SDL_SetSurfacePalette,(SDL_Surface *a, SDL_Palette *b),(a,b),return)
@ -483,8 +483,8 @@ SDL_DYNAPI_PROC(int,SDL_SetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode b),(a
SDL_DYNAPI_PROC(int,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_SetClipRect,(SDL_Surface *a, const SDL_Rect *b),(a,b),return)
SDL_DYNAPI_PROC(void,SDL_GetClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurface,(SDL_Surface *a, const SDL_PixelFormat *b),(a,b),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_ConvertSurfaceFormat,(SDL_Surface *a, Uint32 b),(a,b),return)
SDL_DYNAPI_PROC(int,SDL_ConvertPixels,(int a, int b, Uint32 c, const void *d, int e, Uint32 f, void *g, int h),(a,b,c,d,e,f,g,h),return)
SDL_DYNAPI_PROC(int,SDL_FillRect,(SDL_Surface *a, const SDL_Rect *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(int,SDL_FillRects,(SDL_Surface *a, const SDL_Rect *b, int c, Uint32 d),(a,b,c,d),return)
@ -625,8 +625,8 @@ SDL_DYNAPI_PROC(int,SDL_RenderSetIntegerScale,(SDL_Renderer *a, SDL_bool b),(a,b
SDL_DYNAPI_PROC(SDL_bool,SDL_RenderGetIntegerScale,(SDL_Renderer *a),(a),return)
SDL_DYNAPI_PROC(Uint32,SDL_DequeueAudio,(SDL_AudioDeviceID a, void *b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(void,SDL_SetWindowResizable,(SDL_Window *a, SDL_bool b),(a,b),)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormat,(Uint32 a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, int e, Uint32 f),(a,b,c,d,e,f),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormat,(int a, int b, Uint32 c),(a,b,c),return)
SDL_DYNAPI_PROC(SDL_Surface*,SDL_CreateRGBSurfaceWithFormatFrom,(void *a, int b, int c, int d, Uint32 e),(a,b,c,d,e),return)
SDL_DYNAPI_PROC(SDL_bool,SDL_GetHintBoolean,(const char *a, SDL_bool b),(a,b),return)
SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceVendor,(int a),(a),return)
SDL_DYNAPI_PROC(Uint16,SDL_JoystickGetDeviceProduct,(int a),(a),return)

View File

@ -1254,7 +1254,7 @@ SDL_CreateCursor(const Uint8 * data, const Uint8 * mask,
w = ((w + 7) & ~7);
/* Create the surface from a bitmap */
surface = SDL_CreateRGBSurface(0, w, h, 32,
surface = SDL_CreateRGBSurface(w, h, 32,
0x00FF0000,
0x0000FF00,
0x000000FF,
@ -1311,7 +1311,7 @@ SDL_CreateColorCursor(SDL_Surface *surface, int hot_x, int hot_y)
}
if (surface->format->format != SDL_PIXELFORMAT_ARGB8888) {
temp = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
temp = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888);
if (temp == NULL) {
return NULL;
}

View File

@ -1485,7 +1485,7 @@ SDL_CreateTextureFromSurface(SDL_Renderer * renderer, SDL_Surface * surface)
SDL_DestroyTexture(texture);
return NULL;
}
temp = SDL_ConvertSurface(surface, dst_fmt, 0);
temp = SDL_ConvertSurface(surface, dst_fmt);
SDL_FreeFormat(dst_fmt);
if (temp) {
SDL_UpdateTexture(texture, NULL, temp->pixels, temp->pitch);
@ -2131,7 +2131,7 @@ SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect,
return ret;
}
texture->locked_surface = SDL_CreateRGBSurfaceWithFormatFrom(pixels, real_rect.w, real_rect.h, 0, pitch, texture->format);
texture->locked_surface = SDL_CreateRGBSurfaceWithFormatFrom(pixels, real_rect.w, real_rect.h, pitch, texture->format);
if (texture->locked_surface == NULL) {
SDL_UnlockTexture(texture);
return -1;

View File

@ -413,7 +413,7 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect,
SDL_PixelFormatEnumToMasks(target_format, &bpp, &Rmask, &Gmask,
&Bmask, &Amask);
swdata->stretch =
SDL_CreateRGBSurface(0, swdata->w, swdata->h, bpp, Rmask,
SDL_CreateRGBSurface(swdata->w, swdata->h, bpp, Rmask,
Gmask, Bmask, Amask);
if (!swdata->stretch) {
return -1;

View File

@ -113,7 +113,7 @@ SW_CreateTexture(SDL_Renderer * renderer, SDL_Texture * texture)
}
texture->driverdata =
SDL_CreateRGBSurface(0, texture->w, texture->h, bpp, Rmask, Gmask,
SDL_CreateRGBSurface(texture->w, texture->h, bpp, Rmask, Gmask,
Bmask, Amask);
SDL_SetSurfaceColorMod(texture->driverdata, texture->color.r, texture->color.g, texture->color.b);
SDL_SetSurfaceAlphaMod(texture->driverdata, texture->color.a);
@ -405,7 +405,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex
* to clear the pixels in the destination surface. The other steps are explained below.
*/
if (blendmode == SDL_BLENDMODE_NONE && !isOpaque) {
mask = SDL_CreateRGBSurface(0, final_rect->w, final_rect->h, 32,
mask = SDL_CreateRGBSurface(final_rect->w, final_rect->h, 32,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
if (mask == NULL) {
retval = -1;
@ -419,7 +419,7 @@ SW_RenderCopyEx(SDL_Renderer * renderer, SDL_Surface *surface, SDL_Texture * tex
*/
if (!retval && (blitRequired || applyModulation)) {
SDL_Rect scale_rect = tmp_rect;
src_scaled = SDL_CreateRGBSurface(0, final_rect->w, final_rect->h, 32,
src_scaled = SDL_CreateRGBSurface(final_rect->w, final_rect->h, 32,
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000);
if (src_scaled == NULL) {
retval = -1;
@ -831,7 +831,7 @@ SW_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *vertic
/* Prevent to do scaling + clipping on viewport boundaries as it may lose proportion */
if (dstrect->x < 0 || dstrect->y < 0 || dstrect->x + dstrect->w > surface->w || dstrect->y + dstrect->h > surface->h) {
SDL_Surface *tmp = SDL_CreateRGBSurfaceWithFormat(0, dstrect->w, dstrect->h, 0, src->format->format);
SDL_Surface *tmp = SDL_CreateRGBSurfaceWithFormat(dstrect->w, dstrect->h, src->format->format);
/* Scale to an intermediate surface, then blit */
if (tmp) {
SDL_Rect r;

View File

@ -500,7 +500,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int
rz_dst = NULL;
if (is8bit) {
/* Target surface is 8 bit */
rz_dst = SDL_CreateRGBSurfaceWithFormat(0, rect_dest->w, rect_dest->h + GUARD_ROWS, 8, src->format->format);
rz_dst = SDL_CreateRGBSurfaceWithFormat(rect_dest->w, rect_dest->h + GUARD_ROWS, src->format->format);
if (rz_dst != NULL) {
if (src->format->palette) {
for (i = 0; i < src->format->palette->ncolors; i++) {
@ -511,7 +511,7 @@ SDLgfx_rotateSurface(SDL_Surface * src, double angle, int smooth, int flipx, int
}
} else {
/* Target surface is 32 bit with source RGBA ordering */
rz_dst = SDL_CreateRGBSurface(0, rect_dest->w, rect_dest->h + GUARD_ROWS, 32,
rz_dst = SDL_CreateRGBSurface(rect_dest->w, rect_dest->h + GUARD_ROWS, 32,
src->format->Rmask, src->format->Gmask,
src->format->Bmask, src->format->Amask);
}

View File

@ -274,7 +274,7 @@ int SDL_SW_FillTriangle(SDL_Surface *dst, SDL_Point *d0, SDL_Point *d1, SDL_Poin
}
/* Use an intermediate surface */
tmp = SDL_CreateRGBSurfaceWithFormat(0, dstrect.w, dstrect.h, 0, format);
tmp = SDL_CreateRGBSurfaceWithFormat(dstrect.w, dstrect.h, format);
if (tmp == NULL) {
ret = -1;
goto end;

View File

@ -1766,7 +1766,7 @@ SDLTest_ScreenShot(SDL_Renderer *renderer)
}
SDL_RenderGetViewport(renderer, &viewport);
surface = SDL_CreateRGBSurface(0, viewport.w, viewport.h, 24,
surface = SDL_CreateRGBSurface(viewport.w, viewport.h, 24,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN
0x00FF0000, 0x0000FF00, 0x000000FF,
#else

View File

@ -3185,8 +3185,7 @@ int SDLTest_DrawCharacter(SDL_Renderer *renderer, int x, int y, Uint32 c)
/*
* Redraw character into surface
*/
character = SDL_CreateRGBSurface(SDL_SWSURFACE,
charWidth, charHeight, 32,
character = SDL_CreateRGBSurface(charWidth, charHeight, 32,
0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
if (character == NULL) {
return -1;

View File

@ -417,7 +417,7 @@ SDL_LoadBMP_RW(SDL_RWops * src, int freesrc)
/* Create a compatible surface, note that the colors are RGB ordered */
surface =
SDL_CreateRGBSurface(0, biWidth, biHeight, biBitCount, Rmask, Gmask,
SDL_CreateRGBSurface(biWidth, biHeight, biBitCount, Rmask, Gmask,
Bmask, Amask);
if (surface == NULL) {
was_error = SDL_TRUE;
@ -689,7 +689,7 @@ SDL_SaveBMP_RW(SDL_Surface * saveme, SDL_RWops * dst, int freedst)
} else {
SDL_InitFormat(&format, SDL_PIXELFORMAT_BGR24);
}
surface = SDL_ConvertSurface(saveme, &format, 0);
surface = SDL_ConvertSurface(saveme, &format);
if (surface == NULL) {
SDL_SetError("Couldn't convert image to %d bpp",
format.BitsPerPixel);

View File

@ -68,21 +68,16 @@ SDL_CalculatePitch(Uint32 format, size_t width, SDL_bool minimal)
return pitch;
}
/* TODO: In SDL 3, drop the unused flags and depth parameters */
/*
* Create an empty RGB surface of the appropriate depth using the given
* enum SDL_PIXELFORMAT_* format
*/
SDL_Surface *
SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
Uint32 format)
SDL_CreateRGBSurfaceWithFormat(int width, int height, Uint32 format)
{
size_t pitch;
SDL_Surface *surface;
/* The flags are no longer used, make the compiler happy */
(void)flags;
if (width < 0) {
SDL_InvalidParamError("width");
return NULL;
@ -176,13 +171,11 @@ SDL_CreateRGBSurfaceWithFormat(Uint32 flags, int width, int height, int depth,
return surface;
}
/* TODO: In SDL 3, drop the unused flags parameter */
/*
* Create an empty RGB surface of the appropriate depth
*/
SDL_Surface *
SDL_CreateRGBSurface(Uint32 flags,
int width, int height, int depth,
SDL_CreateRGBSurface(int width, int height, int depth,
Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask)
{
Uint32 format;
@ -194,7 +187,7 @@ SDL_CreateRGBSurface(Uint32 flags,
return NULL;
}
return SDL_CreateRGBSurfaceWithFormat(flags, width, height, depth, format);
return SDL_CreateRGBSurfaceWithFormat(width, height, format);
}
/*
@ -234,7 +227,7 @@ SDL_CreateRGBSurfaceFrom(void *pixels,
return NULL;
}
surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format);
surface = SDL_CreateRGBSurfaceWithFormat(0, 0, format);
if (surface != NULL) {
surface->flags |= SDL_PREALLOC;
surface->pixels = pixels;
@ -246,14 +239,13 @@ SDL_CreateRGBSurfaceFrom(void *pixels,
return surface;
}
/* TODO: In SDL 3, drop the unused depth parameter */
/*
* Create an RGB surface from an existing memory buffer using the given given
* enum SDL_PIXELFORMAT_* format
*/
SDL_Surface *
SDL_CreateRGBSurfaceWithFormatFrom(void *pixels,
int width, int height, int depth, int pitch,
int width, int height, int pitch,
Uint32 format)
{
SDL_Surface *surface;
@ -276,7 +268,7 @@ SDL_CreateRGBSurfaceWithFormatFrom(void *pixels,
return NULL;
}
surface = SDL_CreateRGBSurfaceWithFormat(0, 0, 0, depth, format);
surface = SDL_CreateRGBSurfaceWithFormat(0, 0, format);
if (surface != NULL) {
surface->flags |= SDL_PREALLOC;
surface->pixels = pixels;
@ -1034,13 +1026,11 @@ SDL_PrivateLowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Rect srcrect2;
int is_complex_copy_flags = (src->map->info.flags & complex_copy_flags);
Uint32 flags;
Uint8 r, g, b;
Uint8 alpha;
SDL_BlendMode blendMode;
/* Save source infos */
flags = src->flags;
SDL_GetSurfaceColorMod(src, &r, &g, &b);
SDL_GetSurfaceAlphaMod(src, &alpha);
SDL_GetSurfaceBlendMode(src, &blendMode);
@ -1062,7 +1052,7 @@ SDL_PrivateLowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
} else {
fmt = SDL_PIXELFORMAT_ARGB8888;
}
tmp1 = SDL_CreateRGBSurfaceWithFormat(flags, src->w, src->h, 0, fmt);
tmp1 = SDL_CreateRGBSurfaceWithFormat(src->w, src->h, fmt);
SDL_LowerBlit(src, srcrect, tmp1, &tmprect);
@ -1078,7 +1068,7 @@ SDL_PrivateLowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
/* Intermediate scaling */
if (is_complex_copy_flags || src->format->format != dst->format->format) {
SDL_Rect tmprect;
SDL_Surface *tmp2 = SDL_CreateRGBSurfaceWithFormat(flags, dstrect->w, dstrect->h, 0, src->format->format);
SDL_Surface *tmp2 = SDL_CreateRGBSurfaceWithFormat(dstrect->w, dstrect->h, src->format->format);
SDL_SoftStretchLinear(src, &srcrect2, tmp2, NULL);
SDL_SetSurfaceColorMod(tmp2, r, g, b);
@ -1150,15 +1140,14 @@ SDL_UnlockSurface(SDL_Surface * surface)
SDL_Surface *
SDL_DuplicateSurface(SDL_Surface * surface)
{
return SDL_ConvertSurface(surface, surface->format, surface->flags);
return SDL_ConvertSurface(surface, surface->format);
}
/*
* Convert a surface into the specified pixel format.
*/
SDL_Surface *
SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
Uint32 flags)
SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format)
{
SDL_Surface *convert;
Uint32 copy_flags;
@ -1195,7 +1184,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
}
/* Create a new surface with the desired format */
convert = SDL_CreateRGBSurface(flags, surface->w, surface->h,
convert = SDL_CreateRGBSurface(surface->w, surface->h,
format->BitsPerPixel, format->Rmask,
format->Gmask, format->Bmask,
format->Amask);
@ -1340,7 +1329,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
int converted_colorkey = 0;
/* Create a dummy surface to get the colorkey converted */
tmp = SDL_CreateRGBSurface(0, 1, 1,
tmp = SDL_CreateRGBSurface(1, 1,
surface->format->BitsPerPixel, surface->format->Rmask,
surface->format->Gmask, surface->format->Bmask,
surface->format->Amask);
@ -1355,7 +1344,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
tmp->map->info.flags &= ~SDL_COPY_COLORKEY;
/* Convertion of the colorkey */
tmp2 = SDL_ConvertSurface(tmp, format, 0);
tmp2 = SDL_ConvertSurface(tmp, format);
/* Get the converted colorkey */
SDL_memcpy(&converted_colorkey, tmp2->pixels, tmp2->format->BytesPerPixel);
@ -1381,7 +1370,7 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
(copy_flags & SDL_COPY_MODULATE_ALPHA)) {
SDL_SetSurfaceBlendMode(convert, SDL_BLENDMODE_BLEND);
}
if ((copy_flags & SDL_COPY_RLE_DESIRED) || (flags & SDL_RLEACCEL)) {
if ((copy_flags & SDL_COPY_RLE_DESIRED)) {
SDL_SetSurfaceRLE(convert, SDL_RLEACCEL);
}
@ -1390,15 +1379,14 @@ SDL_ConvertSurface(SDL_Surface * surface, const SDL_PixelFormat * format,
}
SDL_Surface *
SDL_ConvertSurfaceFormat(SDL_Surface * surface, Uint32 pixel_format,
Uint32 flags)
SDL_ConvertSurfaceFormat(SDL_Surface * surface, Uint32 pixel_format)
{
SDL_PixelFormat *fmt;
SDL_Surface *convert = NULL;
fmt = SDL_AllocFormat(pixel_format);
if (fmt) {
convert = SDL_ConvertSurface(surface, fmt, flags);
convert = SDL_ConvertSurface(surface, fmt);
SDL_FreeFormat(fmt);
}
return convert;

View File

@ -2065,7 +2065,7 @@ SDL_SetWindowIcon(SDL_Window * window, SDL_Surface * icon)
SDL_FreeSurface(window->icon);
/* Convert the icon into ARGB8888 */
window->icon = SDL_ConvertSurfaceFormat(icon, SDL_PIXELFORMAT_ARGB8888, 0);
window->icon = SDL_ConvertSurfaceFormat(icon, SDL_PIXELFORMAT_ARGB8888);
if (!window->icon) {
return;
}

View File

@ -90,7 +90,7 @@ Android_CreateCursor(SDL_Surface * surface, int hot_x, int hot_y)
int custom_cursor;
SDL_Surface *converted;
converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888, 0);
converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ARGB8888);
if (converted == NULL) {
return NULL;
}
@ -124,7 +124,7 @@ static SDL_Cursor *
Android_CreateEmptyCursor()
{
if (empty_cursor == NULL) {
SDL_Surface *empty_surface = SDL_CreateRGBSurfaceWithFormat(0, 1, 1, 32, SDL_PIXELFORMAT_ARGB8888);
SDL_Surface *empty_surface = SDL_CreateRGBSurfaceWithFormat(1, 1, SDL_PIXELFORMAT_ARGB8888);
if (empty_surface) {
SDL_memset(empty_surface->pixels, 0, empty_surface->h * empty_surface->pitch);
empty_cursor = Android_CreateCursor(empty_surface, 0, 0);

View File

@ -236,7 +236,7 @@ Cocoa_CreateImage(SDL_Surface * surface)
int i;
NSImage *img;
converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_RGBA32, 0);
converted = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_RGBA32);
if (!converted) {
return nil;
}

View File

@ -39,7 +39,7 @@ int SDL_DUMMY_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * forma
/* Create a new one */
SDL_GetWindowSize(window, &w, &h);
surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format);
surface = SDL_CreateRGBSurfaceWithFormat(w, h, surface_format);
if (surface == NULL) {
return -1;
}

View File

@ -45,7 +45,7 @@ int Emscripten_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * form
SDL_PixelFormatEnumToMasks(surface_format, &bpp, &Rmask, &Gmask, &Bmask, &Amask);
SDL_GetWindowSize(window, &w, &h);
surface = SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
surface = SDL_CreateRGBSurface(w, h, bpp, Rmask, Gmask, Bmask, Amask);
if (surface == NULL) {
return -1;
}

View File

@ -69,7 +69,7 @@ Emscripten_CreateCursor(SDL_Surface* surface, int hot_x, int hot_y)
const char *cursor_url = NULL;
SDL_Surface *conv_surf;
conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888, 0);
conv_surf = SDL_ConvertSurfaceFormat(surface, SDL_PIXELFORMAT_ABGR8888);
if (conv_surf == NULL) {
return NULL;

View File

@ -73,7 +73,7 @@ CreateNewWindowFramebuffer(SDL_Window *window)
Uint32 Rmask, Gmask, Bmask, Amask;
SDL_PixelFormatEnumToMasks(FRAMEBUFFER_FORMAT, &bpp, &Rmask, &Gmask, &Bmask, &Amask);
SDL_GetWindowSize(window, &w, &h);
return SDL_CreateRGBSurface(0, w, h, bpp, Rmask, Gmask, Bmask, Amask);
return SDL_CreateRGBSurface(w, h, bpp, Rmask, Gmask, Bmask, Amask);
}
int

View File

@ -39,7 +39,7 @@ int SDL_OFFSCREEN_CreateWindowFramebuffer(_THIS, SDL_Window * window, Uint32 * f
/* Create a new one */
SDL_GetWindowSize(window, &w, &h);
surface = SDL_CreateRGBSurfaceWithFormat(0, w, h, 0, surface_format);
surface = SDL_CreateRGBSurfaceWithFormat(w, h, surface_format);
if (surface == NULL) {
return -1;
}

View File

@ -176,7 +176,7 @@ static SDL_Cursor *
WIN_CreateBlankCursor()
{
SDL_Cursor *cursor = NULL;
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(0, 32, 32, 32, SDL_PIXELFORMAT_ARGB8888);
SDL_Surface *surface = SDL_CreateRGBSurfaceWithFormat(32, 32, SDL_PIXELFORMAT_ARGB8888);
if (surface) {
cursor = WIN_CreateCursor(surface, 0, 0);
SDL_FreeSurface(surface);

View File

@ -55,7 +55,7 @@ _surfaceSetUp(void *arg)
#endif
referenceSurface = SDLTest_ImageBlit(); /* For size info */
testSurface = SDL_CreateRGBSurface(SDL_SWSURFACE, referenceSurface->w, referenceSurface->h, 32, rmask, gmask, bmask, amask);
testSurface = SDL_CreateRGBSurface(referenceSurface->w, referenceSurface->h, 32, rmask, gmask, bmask, amask);
SDLTest_AssertCheck(testSurface != NULL, "Check that testSurface is not NULL");
if (testSurface != NULL) {
/* Disable blend mode for target surface */
@ -299,7 +299,7 @@ surface_testSurfaceConversion(void *arg)
}
/* Convert to 32 bit to compare. */
rface = SDL_ConvertSurface( face, testSurface->format, 0 );
rface = SDL_ConvertSurface( face, testSurface->format);
SDLTest_AssertPass("Call to SDL_ConvertSurface()");
SDLTest_AssertCheck(rface != NULL, "Verify result from SDL_ConvertSurface is not NULL");
@ -374,19 +374,19 @@ surface_testCompleteSurfaceConversion(void *arg)
for ( j = 0; j < SDL_arraysize(pixel_formats); ++j ) {
fmt1 = SDL_AllocFormat(pixel_formats[i]);
SDL_assert(fmt1 != NULL);
cvt1 = SDL_ConvertSurface(face, fmt1, 0);
cvt1 = SDL_ConvertSurface(face, fmt1);
SDL_assert(cvt1 != NULL);
fmt2 = SDL_AllocFormat(pixel_formats[j]);
SDL_assert(fmt1 != NULL);
cvt2 = SDL_ConvertSurface(cvt1, fmt2, 0);
cvt2 = SDL_ConvertSurface(cvt1, fmt2);
SDL_assert(cvt2 != NULL);
if ( fmt1->BytesPerPixel == face->format->BytesPerPixel &&
fmt2->BytesPerPixel == face->format->BytesPerPixel &&
(fmt1->Amask != 0) == (face->format->Amask != 0) &&
(fmt2->Amask != 0) == (face->format->Amask != 0) ) {
final = SDL_ConvertSurface( cvt2, face->format, 0 );
final = SDL_ConvertSurface( cvt2, face->format);
SDL_assert(final != NULL);
/* Compare surface. */
@ -617,11 +617,11 @@ surface_testOverflow(void *arg)
SDL_memset(buf, '\0', sizeof(buf));
expectedError = "Parameter 'width' is invalid";
surface = SDL_CreateRGBSurfaceWithFormat(0, -3, 100, 8, SDL_PIXELFORMAT_INDEX8);
surface = SDL_CreateRGBSurfaceWithFormat(-3, 100, SDL_PIXELFORMAT_INDEX8);
SDLTest_AssertCheck(surface == NULL, "Should detect negative width");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, -1, 1, 8, 4, SDL_PIXELFORMAT_INDEX8);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, -1, 1, 4, SDL_PIXELFORMAT_INDEX8);
SDLTest_AssertCheck(surface == NULL, "Should detect negative width");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -631,11 +631,11 @@ surface_testOverflow(void *arg)
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
expectedError = "Parameter 'height' is invalid";
surface = SDL_CreateRGBSurfaceWithFormat(0, 100, -3, 8, SDL_PIXELFORMAT_INDEX8);
surface = SDL_CreateRGBSurfaceWithFormat(100, -3, SDL_PIXELFORMAT_INDEX8);
SDLTest_AssertCheck(surface == NULL, "Should detect negative height");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 1, -1, 8, 4, SDL_PIXELFORMAT_INDEX8);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 1, -1, 4, SDL_PIXELFORMAT_INDEX8);
SDLTest_AssertCheck(surface == NULL, "Should detect negative height");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -645,7 +645,7 @@ surface_testOverflow(void *arg)
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
expectedError = "Parameter 'pitch' is invalid";
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 4, 1, 8, -1, SDL_PIXELFORMAT_INDEX8);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 4, 1, -1, SDL_PIXELFORMAT_INDEX8);
SDLTest_AssertCheck(surface == NULL, "Should detect negative pitch");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -657,7 +657,7 @@ surface_testOverflow(void *arg)
/* Less than 1 byte per pixel: the pitch can legitimately be less than
* the width, but it must be enough to hold the appropriate number of
* bits per pixel. SDL_PIXELFORMAT_INDEX4* needs 1 byte per 2 pixels. */
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 6, 1, 4, 3, SDL_PIXELFORMAT_INDEX4LSB);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 6, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface != NULL, "6px * 4 bits per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
@ -666,7 +666,7 @@ surface_testOverflow(void *arg)
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 7, 1, 4, 3, SDL_PIXELFORMAT_INDEX4LSB);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 7, 1, 3, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -675,7 +675,7 @@ surface_testOverflow(void *arg)
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 7, 1, 4, 4, SDL_PIXELFORMAT_INDEX4LSB);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 7, 1, 4, SDL_PIXELFORMAT_INDEX4LSB);
SDLTest_AssertCheck(surface != NULL, "7px * 4 bits per px fits in 4 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
@ -685,7 +685,7 @@ surface_testOverflow(void *arg)
SDL_FreeSurface(surface);
/* SDL_PIXELFORMAT_INDEX1* needs 1 byte per 8 pixels. */
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 16, 1, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 16, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
SDLTest_AssertCheck(surface != NULL, "16px * 1 bit per px fits in 2 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
@ -694,7 +694,7 @@ surface_testOverflow(void *arg)
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 17, 1, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 17, 1, 2, SDL_PIXELFORMAT_INDEX1LSB);
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -703,7 +703,7 @@ surface_testOverflow(void *arg)
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 17, 1, 1, 3, SDL_PIXELFORMAT_INDEX1LSB);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 17, 1, 3, SDL_PIXELFORMAT_INDEX1LSB);
SDLTest_AssertCheck(surface != NULL, "17px * 1 bit per px fits in 3 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
@ -713,7 +713,7 @@ surface_testOverflow(void *arg)
SDL_FreeSurface(surface);
/* SDL_PIXELFORMAT_INDEX8 and SDL_PIXELFORMAT_RGB332 require 1 byte per pixel. */
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 5, 1, 8, 5, SDL_PIXELFORMAT_RGB332);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 5, 1, 5, SDL_PIXELFORMAT_RGB332);
SDLTest_AssertCheck(surface != NULL, "5px * 8 bits per px fits in 5 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
@ -722,7 +722,7 @@ surface_testOverflow(void *arg)
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 6, 1, 8, 5, SDL_PIXELFORMAT_RGB332);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 6, 1, 5, SDL_PIXELFORMAT_RGB332);
SDLTest_AssertCheck(surface == NULL, "Should detect pitch < width * bpp");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -734,7 +734,7 @@ surface_testOverflow(void *arg)
/* Everything else requires more than 1 byte per pixel, and rounds up
* each pixel to an integer number of bytes (e.g. RGB555 is really
* XRGB1555, with 1 bit per pixel wasted). */
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 3, 1, 15, 6, SDL_PIXELFORMAT_RGB555);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 3, 1, 6, SDL_PIXELFORMAT_RGB555);
SDLTest_AssertCheck(surface != NULL, "3px * 15 (really 16) bits per px fits in 6 bytes: %s",
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
@ -743,7 +743,7 @@ surface_testOverflow(void *arg)
surface != NULL ? "(success)" : SDL_GetError());
SDL_FreeSurface(surface);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 4, 1, 15, 6, SDL_PIXELFORMAT_RGB555);
surface = SDL_CreateRGBSurfaceWithFormatFrom(buf, 4, 1, 6, SDL_PIXELFORMAT_RGB555);
SDLTest_AssertCheck(surface == NULL, "4px * 15 (really 16) bits per px doesn't fit in 6 bytes");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
@ -754,19 +754,19 @@ surface_testOverflow(void *arg)
if (sizeof (size_t) == 4 && sizeof (int) >= 4) {
expectedError = "Out of memory";
surface = SDL_CreateRGBSurfaceWithFormat(0, SDL_MAX_SINT32, 1, 8, SDL_PIXELFORMAT_INDEX8);
surface = SDL_CreateRGBSurfaceWithFormat(SDL_MAX_SINT32, 1, SDL_PIXELFORMAT_INDEX8);
SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width + alignment");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateRGBSurfaceWithFormat(0, SDL_MAX_SINT32 / 2, 1, 32, SDL_PIXELFORMAT_ARGB8888);
surface = SDL_CreateRGBSurfaceWithFormat(SDL_MAX_SINT32 / 2, 1, SDL_PIXELFORMAT_ARGB8888);
SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * bytes per pixel");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 29) - 1, (1 << 29) - 1, 8, SDL_PIXELFORMAT_INDEX8);
surface = SDL_CreateRGBSurfaceWithFormat((1 << 29) - 1, (1 << 29) - 1, SDL_PIXELFORMAT_INDEX8);
SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());
surface = SDL_CreateRGBSurfaceWithFormat(0, (1 << 15) + 1, (1 << 15) + 1, 32, SDL_PIXELFORMAT_ARGB8888);
surface = SDL_CreateRGBSurfaceWithFormat((1 << 15) + 1, (1 << 15) + 1, SDL_PIXELFORMAT_ARGB8888);
SDLTest_AssertCheck(surface == NULL, "Should detect overflow in width * height * bytes per pixel");
SDLTest_AssertCheck(SDL_strcmp(SDL_GetError(), expectedError) == 0,
"Expected \"%s\", got \"%s\"", expectedError, SDL_GetError());

View File

@ -612,7 +612,7 @@ main(int argc, char *argv[])
TTF_CloseFont(font);
TTF_Quit();
#endif
g_surf_sdf = SDL_ConvertSurfaceFormat(tmp, SDL_PIXELFORMAT_ABGR8888, 0);
g_surf_sdf = SDL_ConvertSurfaceFormat(tmp, SDL_PIXELFORMAT_ABGR8888);
SDL_SetSurfaceBlendMode(g_surf_sdf, SDL_BLENDMODE_BLEND);
}

View File

@ -61,7 +61,7 @@ save_surface_to_bmp()
pixel_format = SDL_GetWindowPixelFormat(window);
SDL_PixelFormatEnumToMasks(pixel_format, &bbp, &r_mask, &g_mask, &b_mask, &a_mask);
surface = SDL_CreateRGBSurface(0, width, height, bbp, r_mask, g_mask, b_mask, a_mask);
surface = SDL_CreateRGBSurface(width, height, bbp, r_mask, g_mask, b_mask, a_mask);
SDL_RenderReadPixels(renderer, NULL, pixel_format, (void*)surface->pixels, surface->pitch);
SDL_snprintf(file, sizeof(file), "SDL_window%" SDL_PRIs32 "-%8.8d.bmp",

View File

@ -324,7 +324,7 @@ SDL_GL_LoadTexture(SDL_Surface * surface, GLfloat * texcoord)
texcoord[2] = (GLfloat) surface->w / w; /* Max X */
texcoord[3] = (GLfloat) surface->h / h; /* Max Y */
image = SDL_CreateRGBSurface(SDL_SWSURFACE, w, h, 32,
image = SDL_CreateRGBSurface(w, h, 32,
#if SDL_BYTEORDER == SDL_LIL_ENDIAN /* OpenGL RGBA masks */
0x000000FF,
0x0000FF00, 0x00FF0000, 0xFF000000

View File

@ -27,7 +27,7 @@ static SDL_bool is_packed_yuv_format(Uint32 format)
/* Create a surface with a good pattern for verifying YUV conversion */
static SDL_Surface *generate_test_pattern(int pattern_size)
{
SDL_Surface *pattern = SDL_CreateRGBSurfaceWithFormat(0, pattern_size, pattern_size, 0, SDL_PIXELFORMAT_RGB24);
SDL_Surface *pattern = SDL_CreateRGBSurfaceWithFormat(pattern_size, pattern_size, SDL_PIXELFORMAT_RGB24);
if (pattern) {
int i, x, y;
@ -325,7 +325,7 @@ main(int argc, char **argv)
} else {
filename = "testyuv.bmp";
}
original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24, 0);
original = SDL_ConvertSurfaceFormat(SDL_LoadBMP(filename), SDL_PIXELFORMAT_RGB24);
if (original == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't load %s: %s\n", filename, SDL_GetError());
return 3;
@ -337,7 +337,7 @@ main(int argc, char **argv)
0, 100);
pitch = CalculateYUVPitch(yuv_format, original->w);
converted = SDL_CreateRGBSurfaceWithFormat(0, original->w, original->h, 0, rgb_format);
converted = SDL_CreateRGBSurfaceWithFormat(original->w, original->h, rgb_format);
if (converted == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create converted surface: %s\n", SDL_GetError());
return 3;