mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-19 19:28:28 +00:00
Fixed a few remaining functions to directly return their values instead of an error code.
This commit is contained in:
parent
1e828eec57
commit
3d2e5a0b66
15 changed files with 91 additions and 123 deletions
|
@ -1269,6 +1269,8 @@ Textures are created with SDL_SCALEMODE_LINEAR by default, and use SDL_BLENDMODE
|
||||||
|
|
||||||
SDL_QueryTexture() has been removed. The properties of the texture can be queried using SDL_PROP_TEXTURE_FORMAT_NUMBER, SDL_PROP_TEXTURE_ACCESS_NUMBER, SDL_PROP_TEXTURE_WIDTH_NUMBER, and SDL_PROP_TEXTURE_HEIGHT_NUMBER. A function SDL_GetTextureSize() has been added to get the size of the texture as floating point values.
|
SDL_QueryTexture() has been removed. The properties of the texture can be queried using SDL_PROP_TEXTURE_FORMAT_NUMBER, SDL_PROP_TEXTURE_ACCESS_NUMBER, SDL_PROP_TEXTURE_WIDTH_NUMBER, and SDL_PROP_TEXTURE_HEIGHT_NUMBER. A function SDL_GetTextureSize() has been added to get the size of the texture as floating point values.
|
||||||
|
|
||||||
|
SDL_GetRenderDrawBlendMode(), SDL_GetTextureBlendMode(), and SDL_GetTextureScaleMode() have been changed to return the values directly instead of an int error code.
|
||||||
|
|
||||||
Mouse and touch events are no longer filtered to change their coordinates, instead you
|
Mouse and touch events are no longer filtered to change their coordinates, instead you
|
||||||
can call SDL_ConvertEventToRenderCoordinates() to explicitly map event coordinates into
|
can call SDL_ConvertEventToRenderCoordinates() to explicitly map event coordinates into
|
||||||
the rendering viewport.
|
the rendering viewport.
|
||||||
|
@ -1712,6 +1714,8 @@ SDL_SetSurfaceColorKey() takes an SDL_bool to enable and disable colorkey. RLE a
|
||||||
|
|
||||||
SDL_SetSurfaceRLE() takes an SDL_bool to enable and disable RLE acceleration.
|
SDL_SetSurfaceRLE() takes an SDL_bool to enable and disable RLE acceleration.
|
||||||
|
|
||||||
|
SDL_GetSurfaceBlendMode() and SDL_GetSurfaceColorKey() have been changed to return the values directly instead of an int error code.
|
||||||
|
|
||||||
The following functions have been renamed:
|
The following functions have been renamed:
|
||||||
* SDL_BlitScaled() => SDL_BlitSurfaceScaled()
|
* SDL_BlitScaled() => SDL_BlitSurfaceScaled()
|
||||||
* SDL_ConvertSurfaceFormat() => SDL_ConvertSurface()
|
* SDL_ConvertSurfaceFormat() => SDL_ConvertSurface()
|
||||||
|
@ -1749,8 +1753,6 @@ The following symbols have been renamed:
|
||||||
|
|
||||||
SDL_WindowsMessageHook has changed signatures so the message may be modified and it can block further message processing.
|
SDL_WindowsMessageHook has changed signatures so the message may be modified and it can block further message processing.
|
||||||
|
|
||||||
SDL_GetAndroidExternalStorageState() takes the state as an output parameter and returns 0 if the function succeeds or a negative error code if there was an error.
|
|
||||||
|
|
||||||
SDL_RequestAndroidPermission is no longer a blocking call; the caller now provides a callback function that fires when a response is available.
|
SDL_RequestAndroidPermission is no longer a blocking call; the caller now provides a callback function that fires when a response is available.
|
||||||
|
|
||||||
SDL_iPhoneSetAnimationCallback() and SDL_iPhoneSetEventPump() have been renamed to SDL_SetiOSAnimationCallback() and SDL_SetiOSEventPump(), respectively. SDL2 has had macros to provide this new name with the old symbol since the introduction of the iPad, but now the correctly-named symbol is the only option.
|
SDL_iPhoneSetAnimationCallback() and SDL_iPhoneSetEventPump() have been renamed to SDL_SetiOSAnimationCallback() and SDL_SetiOSEventPump(), respectively. SDL2 has had macros to provide this new name with the old symbol since the introduction of the iPad, but now the correctly-named symbol is the only option.
|
||||||
|
|
|
@ -1006,15 +1006,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SD
|
||||||
* Get the blend mode used for texture copy operations.
|
* Get the blend mode used for texture copy operations.
|
||||||
*
|
*
|
||||||
* \param texture the texture to query.
|
* \param texture the texture to query.
|
||||||
* \param blendMode a pointer filled in with the current SDL_BlendMode.
|
* \returns the current SDL_BlendMode.
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetTextureBlendMode
|
* \sa SDL_SetTextureBlendMode
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
|
extern SDL_DECLSPEC SDL_BlendMode SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the scale mode used for texture scale operations.
|
* Set the scale mode used for texture scale operations.
|
||||||
|
@ -1038,15 +1036,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SD
|
||||||
* Get the scale mode used for texture scale operations.
|
* Get the scale mode used for texture scale operations.
|
||||||
*
|
*
|
||||||
* \param texture the texture to query.
|
* \param texture the texture to query.
|
||||||
* \param scaleMode a pointer filled in with the current scale mode.
|
* \returns the current scale mode.
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetTextureScaleMode
|
* \sa SDL_SetTextureScaleMode
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
|
extern SDL_DECLSPEC SDL_ScaleMode SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update the given texture rectangle with new pixel data.
|
* Update the given texture rectangle with new pixel data.
|
||||||
|
@ -1641,15 +1637,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRenderColorScale(SDL_Renderer *renderer,
|
||||||
* Get the color scale used for render operations.
|
* Get the color scale used for render operations.
|
||||||
*
|
*
|
||||||
* \param renderer the rendering context.
|
* \param renderer the rendering context.
|
||||||
* \param scale a pointer filled in with the current color scale value.
|
* \returns the current color scale value.
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetRenderColorScale
|
* \sa SDL_SetRenderColorScale
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale);
|
extern SDL_DECLSPEC float SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the blend mode used for drawing operations (Fill and Line).
|
* Set the blend mode used for drawing operations (Fill and Line).
|
||||||
|
@ -1671,15 +1665,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *rendere
|
||||||
* Get the blend mode used for drawing operations.
|
* Get the blend mode used for drawing operations.
|
||||||
*
|
*
|
||||||
* \param renderer the rendering context.
|
* \param renderer the rendering context.
|
||||||
* \param blendMode a pointer filled in with the current SDL_BlendMode.
|
* \returns the current SDL_BlendMode.
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetRenderDrawBlendMode
|
* \sa SDL_SetRenderDrawBlendMode
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
|
extern SDL_DECLSPEC SDL_BlendMode SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the current rendering target with the drawing color.
|
* Clear the current rendering target with the drawing color.
|
||||||
|
|
|
@ -511,16 +511,14 @@ extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SurfaceHasColorKey(SDL_Surface *surface
|
||||||
* If the surface doesn't have color key enabled this function returns -1.
|
* If the surface doesn't have color key enabled this function returns -1.
|
||||||
*
|
*
|
||||||
* \param surface the SDL_Surface structure to query.
|
* \param surface the SDL_Surface structure to query.
|
||||||
* \param key a pointer filled in with the transparent pixel.
|
* \returns the transparent pixel.
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetSurfaceColorKey
|
* \sa SDL_SetSurfaceColorKey
|
||||||
* \sa SDL_SurfaceHasColorKey
|
* \sa SDL_SurfaceHasColorKey
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key);
|
extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetSurfaceColorKey(SDL_Surface *surface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set an additional color value multiplied into blit operations.
|
* Set an additional color value multiplied into blit operations.
|
||||||
|
@ -620,15 +618,13 @@ extern SDL_DECLSPEC int SDLCALL SDL_SetSurfaceBlendMode(SDL_Surface *surface, SD
|
||||||
* Get the blend mode used for blit operations.
|
* Get the blend mode used for blit operations.
|
||||||
*
|
*
|
||||||
* \param surface the SDL_Surface structure to query.
|
* \param surface the SDL_Surface structure to query.
|
||||||
* \param blendMode a pointer filled in with the current SDL_BlendMode.
|
* \returns the current SDL_BlendMode.
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_SetSurfaceBlendMode
|
* \sa SDL_SetSurfaceBlendMode
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode);
|
extern SDL_DECLSPEC SDL_BlendMode SDLCALL SDL_GetSurfaceBlendMode(SDL_Surface *surface);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the clipping rectangle for a surface.
|
* Set the clipping rectangle for a surface.
|
||||||
|
|
|
@ -426,16 +426,14 @@ extern SDL_DECLSPEC const char *SDLCALL SDL_GetAndroidInternalStoragePath(void);
|
||||||
*
|
*
|
||||||
* If external storage is currently unavailable, this will return 0.
|
* If external storage is currently unavailable, this will return 0.
|
||||||
*
|
*
|
||||||
* \param state filled with the current state of external storage. 0 if
|
* \returns the current state of external storage, or 0 if
|
||||||
* external storage is currently unavailable.
|
* external storage is currently unavailable.
|
||||||
* \returns 0 on success or a negative error code on failure; call
|
|
||||||
* SDL_GetError() for more information.
|
|
||||||
*
|
*
|
||||||
* \since This function is available since SDL 3.0.0.
|
* \since This function is available since SDL 3.0.0.
|
||||||
*
|
*
|
||||||
* \sa SDL_GetAndroidExternalStoragePath
|
* \sa SDL_GetAndroidExternalStoragePath
|
||||||
*/
|
*/
|
||||||
extern SDL_DECLSPEC int SDLCALL SDL_GetAndroidExternalStorageState(Uint32 *state);
|
extern SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the path used for external storage for this Android application.
|
* Get the path used for external storage for this Android application.
|
||||||
|
|
|
@ -142,11 +142,11 @@ const char* SDL_GetAndroidExternalStoragePath()
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_DECLSPEC int SDLCALL SDL_GetAndroidExternalStorageState(Uint32 *state);
|
SDL_DECLSPEC Uint32 SDLCALL SDL_GetAndroidExternalStorageState(void);
|
||||||
int SDL_GetAndroidExternalStorageState(Uint32 *state)
|
Uint32 SDL_GetAndroidExternalStorageState(void)
|
||||||
{
|
{
|
||||||
(void)state;
|
SDL_Unsupported();
|
||||||
return SDL_Unsupported();
|
return 0;
|
||||||
}
|
}
|
||||||
SDL_DECLSPEC const char *SDLCALL SDL_GetAndroidInternalStoragePath(void);
|
SDL_DECLSPEC const char *SDLCALL SDL_GetAndroidInternalStoragePath(void);
|
||||||
const char *SDL_GetAndroidInternalStoragePath(void)
|
const char *SDL_GetAndroidInternalStoragePath(void)
|
||||||
|
|
|
@ -2507,22 +2507,19 @@ const char *SDL_GetAndroidInternalStoragePath(void)
|
||||||
return s_AndroidInternalFilesPath;
|
return s_AndroidInternalFilesPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetAndroidExternalStorageState(Uint32 *state)
|
Uint32 SDL_GetAndroidExternalStorageState(void)
|
||||||
{
|
{
|
||||||
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
|
struct LocalReferenceHolder refs = LocalReferenceHolder_Setup(__FUNCTION__);
|
||||||
jmethodID mid;
|
jmethodID mid;
|
||||||
jclass cls;
|
jclass cls;
|
||||||
jstring stateString;
|
jstring stateString;
|
||||||
const char *state_string;
|
const char *state_string;
|
||||||
int stateFlags;
|
Uint32 stateFlags;
|
||||||
|
|
||||||
JNIEnv *env = Android_JNI_GetEnv();
|
JNIEnv *env = Android_JNI_GetEnv();
|
||||||
if (!LocalReferenceHolder_Init(&refs, env)) {
|
if (!LocalReferenceHolder_Init(&refs, env)) {
|
||||||
LocalReferenceHolder_Cleanup(&refs);
|
LocalReferenceHolder_Cleanup(&refs);
|
||||||
if (state) {
|
return 0;
|
||||||
*state = 0;
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cls = (*env)->FindClass(env, "android/os/Environment");
|
cls = (*env)->FindClass(env, "android/os/Environment");
|
||||||
|
@ -2546,10 +2543,8 @@ int SDL_GetAndroidExternalStorageState(Uint32 *state)
|
||||||
(*env)->ReleaseStringUTFChars(env, stateString, state_string);
|
(*env)->ReleaseStringUTFChars(env, stateString, state_string);
|
||||||
|
|
||||||
LocalReferenceHolder_Cleanup(&refs);
|
LocalReferenceHolder_Cleanup(&refs);
|
||||||
if (state) {
|
|
||||||
*state = stateFlags;
|
return stateFlags;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// this caches a string until the process ends, so there's no need to use SDL_FreeLater.
|
// this caches a string until the process ends, so there's no need to use SDL_FreeLater.
|
||||||
|
|
|
@ -196,7 +196,7 @@ SDL_DYNAPI_PROC(SDL_bool,SDL_GamepadSensorEnabled,(SDL_Gamepad *a, SDL_SensorTyp
|
||||||
SDL_DYNAPI_PROC(void*,SDL_GetAndroidActivity,(void),(),return)
|
SDL_DYNAPI_PROC(void*,SDL_GetAndroidActivity,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetAndroidCachePath,(void),(),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetAndroidCachePath,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetAndroidExternalStoragePath,(void),(),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetAndroidExternalStoragePath,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetAndroidExternalStorageState,(Uint32 *a),(a),return)
|
SDL_DYNAPI_PROC(Uint32,SDL_GetAndroidExternalStorageState,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetAndroidInternalStoragePath,(void),(),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetAndroidInternalStoragePath,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(void*,SDL_GetAndroidJNIEnv,(void),(),return)
|
SDL_DYNAPI_PROC(void*,SDL_GetAndroidJNIEnv,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return)
|
SDL_DYNAPI_PROC(int,SDL_GetAndroidSDKVersion,(void),(),return)
|
||||||
|
@ -433,8 +433,8 @@ SDL_DYNAPI_PROC(int,SDL_GetRectUnionFloat,(const SDL_FRect *a, const SDL_FRect *
|
||||||
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRelativeMouseMode,(void),(),return)
|
SDL_DYNAPI_PROC(SDL_bool,SDL_GetRelativeMouseMode,(void),(),return)
|
||||||
SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetRelativeMouseState,(float *a, float *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_MouseButtonFlags,SDL_GetRelativeMouseState,(float *a, float *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderClipRect,(SDL_Renderer *a, SDL_Rect *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderColorScale,(SDL_Renderer *a, float *b),(a,b),return)
|
SDL_DYNAPI_PROC(float,SDL_GetRenderColorScale,(SDL_Renderer *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawBlendMode,(SDL_Renderer *a, SDL_BlendMode *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_BlendMode,SDL_GetRenderDrawBlendMode,(SDL_Renderer *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColor,(SDL_Renderer *a, Uint8 *b, Uint8 *c, Uint8 *d, Uint8 *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColorFloat,(SDL_Renderer *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return)
|
SDL_DYNAPI_PROC(int,SDL_GetRenderDrawColorFloat,(SDL_Renderer *a, float *b, float *c, float *d, float *e),(a,b,c,d,e),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetRenderDriver,(int a),(a),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetRenderDriver,(int a),(a),return)
|
||||||
|
@ -475,9 +475,9 @@ SDL_DYNAPI_PROC(int,SDL_GetStoragePathInfo,(SDL_Storage *a, const char *b, SDL_P
|
||||||
SDL_DYNAPI_PROC(Uint64,SDL_GetStorageSpaceRemaining,(SDL_Storage *a),(a),return)
|
SDL_DYNAPI_PROC(Uint64,SDL_GetStorageSpaceRemaining,(SDL_Storage *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetStringProperty,(SDL_PropertiesID a, const char *b, const char *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetStringProperty,(SDL_PropertiesID a, const char *b, const char *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetSurfaceAlphaMod,(SDL_Surface *a, Uint8 *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceBlendMode,(SDL_Surface *a, SDL_BlendMode *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_BlendMode,SDL_GetSurfaceBlendMode,(SDL_Surface *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetSurfaceClipRect,(SDL_Surface *a, SDL_Rect *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorKey,(SDL_Surface *a, Uint32 *b),(a,b),return)
|
SDL_DYNAPI_PROC(Uint32,SDL_GetSurfaceColorKey,(SDL_Surface *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
|
SDL_DYNAPI_PROC(int,SDL_GetSurfaceColorMod,(SDL_Surface *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Colorspace,SDL_GetSurfaceColorspace,(SDL_Surface *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Colorspace,SDL_GetSurfaceColorspace,(SDL_Surface *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(SDL_Palette*,SDL_GetSurfacePalette,(SDL_Surface *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_Palette*,SDL_GetSurfacePalette,(SDL_Surface *a),(a),return)
|
||||||
|
@ -488,11 +488,11 @@ SDL_DYNAPI_PROC(void*,SDL_GetTLS,(SDL_TLSID *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetTextInputArea,(SDL_Window *a, SDL_Rect *b, int *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GetTextInputArea,(SDL_Window *a, SDL_Rect *b, int *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetTextureAlphaMod,(SDL_Texture *a, Uint8 *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetTextureAlphaMod,(SDL_Texture *a, Uint8 *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetTextureAlphaModFloat,(SDL_Texture *a, float *b),(a,b),return)
|
SDL_DYNAPI_PROC(int,SDL_GetTextureAlphaModFloat,(SDL_Texture *a, float *b),(a,b),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetTextureBlendMode,(SDL_Texture *a, SDL_BlendMode *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_BlendMode,SDL_GetTextureBlendMode,(SDL_Texture *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetTextureColorMod,(SDL_Texture *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
|
SDL_DYNAPI_PROC(int,SDL_GetTextureColorMod,(SDL_Texture *a, Uint8 *b, Uint8 *c, Uint8 *d),(a,b,c,d),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetTextureColorModFloat,(SDL_Texture *a, float *b, float *c, float *d),(a,b,c,d),return)
|
SDL_DYNAPI_PROC(int,SDL_GetTextureColorModFloat,(SDL_Texture *a, float *b, float *c, float *d),(a,b,c,d),return)
|
||||||
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetTextureProperties,(SDL_Texture *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_PropertiesID,SDL_GetTextureProperties,(SDL_Texture *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetTextureScaleMode,(SDL_Texture *a, SDL_ScaleMode *b),(a,b),return)
|
SDL_DYNAPI_PROC(SDL_ScaleMode,SDL_GetTextureScaleMode,(SDL_Texture *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(int,SDL_GetTextureSize,(SDL_Texture *a, float *b, float *c),(a,b,c),return)
|
SDL_DYNAPI_PROC(int,SDL_GetTextureSize,(SDL_Texture *a, float *b, float *c),(a,b,c),return)
|
||||||
SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetThreadID,(SDL_Thread *a),(a),return)
|
SDL_DYNAPI_PROC(SDL_ThreadID,SDL_GetThreadID,(SDL_Thread *a),(a),return)
|
||||||
SDL_DYNAPI_PROC(const char*,SDL_GetThreadName,(SDL_Thread *a),(a),return)
|
SDL_DYNAPI_PROC(const char*,SDL_GetThreadName,(SDL_Thread *a),(a),return)
|
||||||
|
|
|
@ -1641,7 +1641,6 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||||
|
|
||||||
{
|
{
|
||||||
Uint8 r, g, b, a;
|
Uint8 r, g, b, a;
|
||||||
SDL_BlendMode blendMode;
|
|
||||||
|
|
||||||
SDL_GetSurfaceColorMod(surface, &r, &g, &b);
|
SDL_GetSurfaceColorMod(surface, &r, &g, &b);
|
||||||
SDL_SetTextureColorMod(texture, r, g, b);
|
SDL_SetTextureColorMod(texture, r, g, b);
|
||||||
|
@ -1653,8 +1652,7 @@ SDL_Texture *SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *s
|
||||||
/* We converted to a texture with alpha format */
|
/* We converted to a texture with alpha format */
|
||||||
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
SDL_SetTextureBlendMode(texture, SDL_BLENDMODE_BLEND);
|
||||||
} else {
|
} else {
|
||||||
SDL_GetSurfaceBlendMode(surface, &blendMode);
|
SDL_SetTextureBlendMode(texture, SDL_GetSurfaceBlendMode(surface));
|
||||||
SDL_SetTextureBlendMode(texture, blendMode);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return texture;
|
return texture;
|
||||||
|
@ -1799,6 +1797,10 @@ int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
|
||||||
|
|
||||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
CHECK_TEXTURE_MAGIC(texture, -1);
|
||||||
|
|
||||||
|
if (blendMode == SDL_BLENDMODE_INVALID) {
|
||||||
|
return SDL_InvalidParamError("blendMode");
|
||||||
|
}
|
||||||
|
|
||||||
renderer = texture->renderer;
|
renderer = texture->renderer;
|
||||||
if (!IsSupportedBlendMode(renderer, blendMode)) {
|
if (!IsSupportedBlendMode(renderer, blendMode)) {
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
|
@ -1810,14 +1812,11 @@ int SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
|
SDL_BlendMode SDL_GetTextureBlendMode(SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
CHECK_TEXTURE_MAGIC(texture, SDL_BLENDMODE_INVALID);
|
||||||
|
|
||||||
if (blendMode) {
|
return texture->blendMode;
|
||||||
*blendMode = texture->blendMode;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
int SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
|
@ -1836,14 +1835,11 @@ int SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
|
SDL_ScaleMode SDL_GetTextureScaleMode(SDL_Texture *texture)
|
||||||
{
|
{
|
||||||
CHECK_TEXTURE_MAGIC(texture, -1);
|
CHECK_TEXTURE_MAGIC(texture, SDL_SCALEMODE_LINEAR);
|
||||||
|
|
||||||
if (scaleMode) {
|
return texture->scaleMode;
|
||||||
*scaleMode = texture->scaleMode;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SDL_HAVE_YUV
|
#if SDL_HAVE_YUV
|
||||||
|
@ -3069,20 +3065,21 @@ int SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale)
|
float SDL_GetRenderColorScale(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, 1.0f);
|
||||||
|
|
||||||
if (scale) {
|
return renderer->color_scale / renderer->SDR_white_point;
|
||||||
*scale = renderer->color_scale / renderer->SDR_white_point;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
|
|
||||||
|
if (blendMode == SDL_BLENDMODE_INVALID) {
|
||||||
|
return SDL_InvalidParamError("blendMode");
|
||||||
|
}
|
||||||
|
|
||||||
if (!IsSupportedBlendMode(renderer, blendMode)) {
|
if (!IsSupportedBlendMode(renderer, blendMode)) {
|
||||||
return SDL_Unsupported();
|
return SDL_Unsupported();
|
||||||
}
|
}
|
||||||
|
@ -3090,20 +3087,18 @@ int SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
|
SDL_BlendMode SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, SDL_BLENDMODE_INVALID);
|
||||||
|
|
||||||
*blendMode = renderer->blendMode;
|
return renderer->blendMode;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_RenderClear(SDL_Renderer *renderer)
|
int SDL_RenderClear(SDL_Renderer *renderer)
|
||||||
{
|
{
|
||||||
int retval;
|
|
||||||
CHECK_RENDERER_MAGIC(renderer, -1);
|
CHECK_RENDERER_MAGIC(renderer, -1);
|
||||||
retval = QueueCmdClear(renderer);
|
|
||||||
return retval;
|
return QueueCmdClear(renderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_RenderPoint(SDL_Renderer *renderer, float x, float y)
|
int SDL_RenderPoint(SDL_Renderer *renderer, float x, float y)
|
||||||
|
@ -3970,7 +3965,7 @@ static int SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
|
||||||
float r = 0, g = 0, b = 0, a = 0;
|
float r = 0, g = 0, b = 0, a = 0;
|
||||||
|
|
||||||
/* Save */
|
/* Save */
|
||||||
SDL_GetRenderDrawBlendMode(renderer, &blendMode);
|
blendMode = SDL_GetRenderDrawBlendMode(renderer);
|
||||||
SDL_GetRenderDrawColorFloat(renderer, &r, &g, &b, &a);
|
SDL_GetRenderDrawColorFloat(renderer, &r, &g, &b, &a);
|
||||||
|
|
||||||
if (texture) {
|
if (texture) {
|
||||||
|
|
|
@ -355,7 +355,7 @@ static int SW_RenderCopyEx(SDL_Renderer *renderer, SDL_Surface *surface, SDL_Tex
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_GetSurfaceBlendMode(src, &blendmode);
|
blendmode = SDL_GetSurfaceBlendMode(src);
|
||||||
SDL_GetSurfaceAlphaMod(src, &alphaMod);
|
SDL_GetSurfaceAlphaMod(src, &alphaMod);
|
||||||
SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
|
SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ static int SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, vo
|
||||||
SDL_BlendMode blendmode;
|
SDL_BlendMode blendmode;
|
||||||
Uint8 alphaMod, rMod, gMod, bMod;
|
Uint8 alphaMod, rMod, gMod, bMod;
|
||||||
|
|
||||||
SDL_GetSurfaceBlendMode(src, &blendmode);
|
blendmode = SDL_GetSurfaceBlendMode(src);
|
||||||
SDL_GetSurfaceAlphaMod(src, &alphaMod);
|
SDL_GetSurfaceAlphaMod(src, &alphaMod);
|
||||||
SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
|
SDL_GetSurfaceColorMod(src, &rMod, &gMod, &bMod);
|
||||||
|
|
||||||
|
|
|
@ -78,11 +78,7 @@ Returns colorkey info for a surface
|
||||||
*/
|
*/
|
||||||
static Uint32 get_colorkey(SDL_Surface *src)
|
static Uint32 get_colorkey(SDL_Surface *src)
|
||||||
{
|
{
|
||||||
Uint32 key = 0;
|
return SDL_GetSurfaceColorKey(src);
|
||||||
if (SDL_SurfaceHasColorKey(src)) {
|
|
||||||
SDL_GetSurfaceColorKey(src, &key);
|
|
||||||
}
|
|
||||||
return key;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* rotate (sx, sy) by (angle, center) into (dx, dy) */
|
/* rotate (sx, sy) by (angle, center) into (dx, dy) */
|
||||||
|
@ -501,9 +497,8 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||||
}
|
}
|
||||||
|
|
||||||
if (SDL_SurfaceHasColorKey(src)) {
|
if (SDL_SurfaceHasColorKey(src)) {
|
||||||
if (SDL_GetSurfaceColorKey(src, &colorkey) == 0) {
|
colorkey = SDL_GetSurfaceColorKey(src);
|
||||||
colorKeyAvailable = SDL_TRUE;
|
colorKeyAvailable = SDL_TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* This function requires a 32-bit surface or 8-bit surface with a colorkey */
|
/* This function requires a 32-bit surface or 8-bit surface with a colorkey */
|
||||||
is8bit = src->internal->format->bits_per_pixel == 8 && colorKeyAvailable;
|
is8bit = src->internal->format->bits_per_pixel == 8 && colorKeyAvailable;
|
||||||
|
@ -536,7 +531,7 @@ SDL_Surface *SDLgfx_rotateSurface(SDL_Surface *src, double angle, int smooth, in
|
||||||
/* Adjust for guard rows */
|
/* Adjust for guard rows */
|
||||||
rz_dst->h = rect_dest->h;
|
rz_dst->h = rect_dest->h;
|
||||||
|
|
||||||
SDL_GetSurfaceBlendMode(src, &blendmode);
|
blendmode = SDL_GetSurfaceBlendMode(src);
|
||||||
|
|
||||||
if (colorKeyAvailable == SDL_TRUE) {
|
if (colorKeyAvailable == SDL_TRUE) {
|
||||||
/* If available, the colorkey will be used to discard the pixels that are outside of the rotated area. */
|
/* If available, the colorkey will be used to discard the pixels that are outside of the rotated area. */
|
||||||
|
|
|
@ -524,7 +524,7 @@ int SDL_SW_BlitTriangle(
|
||||||
|
|
||||||
bounding_rect_fixedpoint(d0, d1, d2, &dstrect);
|
bounding_rect_fixedpoint(d0, d1, d2, &dstrect);
|
||||||
|
|
||||||
SDL_GetSurfaceBlendMode(src, &blend);
|
blend = SDL_GetSurfaceBlendMode(src);
|
||||||
|
|
||||||
/* TRIANGLE_GET_TEXTCOORD interpolates up to the max values included, so reduce by 1 */
|
/* TRIANGLE_GET_TEXTCOORD interpolates up to the max values included, so reduce by 1 */
|
||||||
{
|
{
|
||||||
|
|
|
@ -515,20 +515,13 @@ SDL_bool SDL_SurfaceHasColorKey(SDL_Surface *surface)
|
||||||
return SDL_TRUE;
|
return SDL_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetSurfaceColorKey(SDL_Surface *surface, Uint32 *key)
|
Uint32 SDL_GetSurfaceColorKey(SDL_Surface *surface)
|
||||||
{
|
{
|
||||||
if (!SDL_SurfaceValid(surface)) {
|
if (!SDL_SurfaceValid(surface)) {
|
||||||
return SDL_InvalidParamError("surface");
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(surface->internal->map.info.flags & SDL_COPY_COLORKEY)) {
|
return surface->internal->map.info.colorkey;
|
||||||
return SDL_SetError("Surface doesn't have a colorkey");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (key) {
|
|
||||||
*key = surface->internal->map.info.colorkey;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is a fairly slow function to switch from colorkey to alpha
|
/* This is a fairly slow function to switch from colorkey to alpha
|
||||||
|
@ -706,6 +699,10 @@ int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode)
|
||||||
return SDL_InvalidParamError("surface");
|
return SDL_InvalidParamError("surface");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (blendMode == SDL_BLENDMODE_INVALID) {
|
||||||
|
return SDL_InvalidParamError("blendMode");
|
||||||
|
}
|
||||||
|
|
||||||
status = 0;
|
status = 0;
|
||||||
flags = surface->internal->map.info.flags;
|
flags = surface->internal->map.info.flags;
|
||||||
surface->internal->map.info.flags &= ~(SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL);
|
surface->internal->map.info.flags &= ~(SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL);
|
||||||
|
@ -742,40 +739,39 @@ int SDL_SetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode blendMode)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SDL_GetSurfaceBlendMode(SDL_Surface *surface, SDL_BlendMode *blendMode)
|
SDL_BlendMode SDL_GetSurfaceBlendMode(SDL_Surface *surface)
|
||||||
{
|
{
|
||||||
if (!SDL_SurfaceValid(surface)) {
|
SDL_BlendMode blendMode;
|
||||||
return SDL_InvalidParamError("surface");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!blendMode) {
|
if (!SDL_SurfaceValid(surface)) {
|
||||||
return 0;
|
SDL_InvalidParamError("surface");
|
||||||
|
return SDL_BLENDMODE_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (surface->internal->map.info.flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) {
|
switch (surface->internal->map.info.flags & (SDL_COPY_BLEND | SDL_COPY_BLEND_PREMULTIPLIED | SDL_COPY_ADD | SDL_COPY_ADD_PREMULTIPLIED | SDL_COPY_MOD | SDL_COPY_MUL)) {
|
||||||
case SDL_COPY_BLEND:
|
case SDL_COPY_BLEND:
|
||||||
*blendMode = SDL_BLENDMODE_BLEND;
|
blendMode = SDL_BLENDMODE_BLEND;
|
||||||
break;
|
break;
|
||||||
case SDL_COPY_BLEND_PREMULTIPLIED:
|
case SDL_COPY_BLEND_PREMULTIPLIED:
|
||||||
*blendMode = SDL_BLENDMODE_BLEND_PREMULTIPLIED;
|
blendMode = SDL_BLENDMODE_BLEND_PREMULTIPLIED;
|
||||||
break;
|
break;
|
||||||
case SDL_COPY_ADD:
|
case SDL_COPY_ADD:
|
||||||
*blendMode = SDL_BLENDMODE_ADD;
|
blendMode = SDL_BLENDMODE_ADD;
|
||||||
break;
|
break;
|
||||||
case SDL_COPY_ADD_PREMULTIPLIED:
|
case SDL_COPY_ADD_PREMULTIPLIED:
|
||||||
*blendMode = SDL_BLENDMODE_ADD_PREMULTIPLIED;
|
blendMode = SDL_BLENDMODE_ADD_PREMULTIPLIED;
|
||||||
break;
|
break;
|
||||||
case SDL_COPY_MOD:
|
case SDL_COPY_MOD:
|
||||||
*blendMode = SDL_BLENDMODE_MOD;
|
blendMode = SDL_BLENDMODE_MOD;
|
||||||
break;
|
break;
|
||||||
case SDL_COPY_MUL:
|
case SDL_COPY_MUL:
|
||||||
*blendMode = SDL_BLENDMODE_MUL;
|
blendMode = SDL_BLENDMODE_MUL;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
*blendMode = SDL_BLENDMODE_NONE;
|
blendMode = SDL_BLENDMODE_NONE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return blendMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_bool SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect)
|
SDL_bool SDL_SetSurfaceClipRect(SDL_Surface *surface, const SDL_Rect *rect)
|
||||||
|
@ -1151,7 +1147,7 @@ int SDL_BlitSurfaceUncheckedScaled(SDL_Surface *src, const SDL_Rect *srcrect,
|
||||||
/* Save source infos */
|
/* Save source infos */
|
||||||
SDL_GetSurfaceColorMod(src, &r, &g, &b);
|
SDL_GetSurfaceColorMod(src, &r, &g, &b);
|
||||||
SDL_GetSurfaceAlphaMod(src, &alpha);
|
SDL_GetSurfaceAlphaMod(src, &alpha);
|
||||||
SDL_GetSurfaceBlendMode(src, &blendMode);
|
blendMode = SDL_GetSurfaceBlendMode(src);
|
||||||
srcrect2.x = srcrect->x;
|
srcrect2.x = srcrect->x;
|
||||||
srcrect2.y = srcrect->y;
|
srcrect2.y = srcrect->y;
|
||||||
srcrect2.w = srcrect->w;
|
srcrect2.w = srcrect->w;
|
||||||
|
|
|
@ -402,9 +402,8 @@ static void testBlendModeOperation(TestRenderOperation op, int mode, SDL_PixelFo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (SDL_ISPIXELFORMAT_ALPHA(dst_format)) {
|
if (SDL_ISPIXELFORMAT_ALPHA(dst_format)) {
|
||||||
SDL_BlendMode blendMode = SDL_BLENDMODE_NONE;
|
SDL_BlendMode blendMode = SDL_GetTextureBlendMode(dst);
|
||||||
ret = SDL_GetTextureBlendMode(dst, &blendMode);
|
SDLTest_AssertCheck(blendMode != SDL_BLENDMODE_INVALID, "Verify result from SDL_GetTextureBlendMode(), expected: !SDL_BLENDMODE_INVALID, got: 0x%" SDL_PRIx32, blendMode);
|
||||||
SDLTest_AssertCheck(ret == 0, "Verify result from SDL_GetTextureBlendMode(), expected: 0, got: %i", ret);
|
|
||||||
SDLTest_AssertCheck(blendMode == SDL_BLENDMODE_BLEND, "Verify alpha texture blend mode, expected %d, got %" SDL_PRIu32, SDL_BLENDMODE_BLEND, blendMode);
|
SDLTest_AssertCheck(blendMode == SDL_BLENDMODE_BLEND, "Verify alpha texture blend mode, expected %d, got %" SDL_PRIu32, SDL_BLENDMODE_BLEND, blendMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,8 +54,8 @@ static void surfaceSetUp(void *arg)
|
||||||
/* Disable blend mode for target surface */
|
/* Disable blend mode for target surface */
|
||||||
result = SDL_SetSurfaceBlendMode(testSurface, blendMode);
|
result = SDL_SetSurfaceBlendMode(testSurface, blendMode);
|
||||||
SDLTest_AssertCheck(result == 0, "Validate result from SDL_SetSurfaceBlendMode, expected: 0, got: %i", result);
|
SDLTest_AssertCheck(result == 0, "Validate result from SDL_SetSurfaceBlendMode, expected: 0, got: %i", result);
|
||||||
result = SDL_GetSurfaceBlendMode(testSurface, ¤tBlendMode);
|
currentBlendMode = SDL_GetSurfaceBlendMode(testSurface);
|
||||||
SDLTest_AssertCheck(result == 0, "Validate result from SDL_GetSurfaceBlendMode, expected: 0, got: %i", result);
|
SDLTest_AssertCheck(currentBlendMode != SDL_BLENDMODE_INVALID, "Validate result from SDL_GetSurfaceBlendMode, expected: !SDL_BLENDMODE_INVALID, got: 0x%" SDL_PRIx32, currentBlendMode);
|
||||||
SDLTest_AssertCheck(currentBlendMode == blendMode, "Validate blendMode, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32, blendMode, currentBlendMode);
|
SDLTest_AssertCheck(currentBlendMode == blendMode, "Validate blendMode, expected: %" SDL_PRIu32 ", got: %" SDL_PRIu32, blendMode, currentBlendMode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ SDL_GL_LoadTexture(SDL_Surface *surface, GLfloat *texcoord)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save the alpha blending attributes */
|
/* Save the alpha blending attributes */
|
||||||
SDL_GetSurfaceBlendMode(surface, &saved_mode);
|
saved_mode = SDL_GetSurfaceBlendMode(surface);
|
||||||
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
|
SDL_SetSurfaceBlendMode(surface, SDL_BLENDMODE_NONE);
|
||||||
|
|
||||||
/* Copy the surface into the GL texture image */
|
/* Copy the surface into the GL texture image */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue