16293 Commits

Author SHA1 Message Date
Sam Lantinga
38a301a3f9 Added automated tests to verify SDL_ClearSurface() and SDL_PremultiplySurfaceAlpha() 2024-07-17 18:04:16 -07:00
Sam Lantinga
02a072a1b7 Added SDL_ClearSurface() and SDL_ReadSurfacePixelFloat() 2024-07-17 18:04:16 -07:00
Sam Lantinga
b07bd55baf Fixed use of SDL_expand_byte after flipping from bit loss to bit count 2024-07-17 18:04:16 -07:00
Sam Lantinga
cd25cb3435 Check SDL_LockSurface() return value 2024-07-17 18:04:16 -07:00
Sam Lantinga
eefcb62588 SDL_MUSTLOCK() returns true once a surface has the RLE flag set
This more closely matches the mental model of people using SDL, and locking a surface that isn't RLE encoded doesn't cause any issues.

Fixes https://github.com/libsdl-org/SDL/issues/5594
2024-07-17 18:04:16 -07:00
Sam Lantinga
de6595bda6 SDL_MUSTLOCK() should return true if the surface needs locking even if it's currently locked.
There's a bunch of code that assumes this in SDL, and presumably in applications as well.
2024-07-17 18:04:16 -07:00
Sam Lantinga
334962b056 Enhancements for SDL_PremultiplyAlpha()
The function can now convert between pixels of different formats, and takes a parameter to control whether the premultiplication is done in sRGB or linear space.

Also added SDL_PremultiplySurfaceAlpha(), which can premultiply the pixels of a surface in-place.
2024-07-17 18:04:16 -07:00
Frank Praznik
b99ea1ff75
wayland: Add SDL_VIDEO_DOUBLE_BUFFER support
Manual cherry-pick of 9e6b8d56e33f77dab507236d84a3f76b6fea7b2a

thanks @vanfanel
2024-07-17 18:27:46 -04:00
Amir
5db08b86ca Fix warning for Android NDK compiler: "function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]"
https://stackoverflow.com/questions/42125/warning-error-function-declaration-isnt-a-prototype
In C int foo() and int foo(void) are different functions. int foo() accepts an arbitrary number of arguments, while int foo(void) accepts 0 arguments. In C++ they mean the same thing.
2024-07-17 14:09:11 -07:00
Sam Lantinga
94c40fb3c9 Fixed warning: no previous prototype for function 'SDL_InitFilesystem' 2024-07-17 11:00:25 -07:00
Sam Lantinga
761e86e25e Initialize output parameters to reasonable defaults in case of error 2024-07-17 10:27:37 -07:00
Sam Lantinga
5f5e91eab6 Reverted 3d2e5a0b66eca4ade34f2a4fa81c8f4d8d33dac3
Applying these changes to external code doesn't actually improve anything, and within the context of the other Get* functions for renderers and surfaces, these stand out as outliers, so I'm going to back this change out.
2024-07-17 10:27:37 -07:00
Sam Lantinga
b3df46e4bc Added missing SDL_sysfilesystem.h includes 2024-07-17 09:09:42 -07:00
Ozkan Sezer
2eda7b2c24 SDL_sysvideo.h: remove SDL_DisplayModeData typedef:
Fixes a type redefinition error:

In file included from /tmp/SDL3/test/../src/events/SDL_events_c.h:28,
                 from /tmp/SDL3/test/../src/events/SDL_pen.c:26,
                 from /tmp/SDL3/test/testautomation_pen.c:83:
/tmp/SDL3/test/../src/events/../video/SDL_sysvideo.h:34: error: redefinition of typedef 'SDL_DisplayModeData'
/tmp/SDL3/include/SDL3/SDL_video.h:78: note: previous declaration of 'SDL_DisplayModeData' was here
2024-07-17 12:30:32 +03:00
Sam Lantinga
8c25129458 SDL_EVENT_WINDOW_LAST should be SDL_EVENT_WINDOW_HDR_STATE_CHANGED
Fixes https://github.com/libsdl-org/SDL/issues/10299
2024-07-16 22:43:02 -07:00
SDL Wiki Bot
b92ec25147 Sync SDL3 wiki -> header 2024-07-17 04:33:30 +00:00
Sam Lantinga
3d2e5a0b66 Fixed a few remaining functions to directly return their values instead of an error code. 2024-07-16 21:32:17 -07:00
Sam Lantinga
1e828eec57 Fixed warning C4244: '=': conversion from 'float' to 'int', possible loss of data 2024-07-16 21:32:17 -07:00
Sam Lantinga
98bea25363 Converted surfaces with alpha format default to SDL_BLENDMODE_BLEND
Fixes https://github.com/libsdl-org/SDL/pull/4690
2024-07-16 18:50:22 -07:00
Sam Lantinga
7c0307060d Textures with alpha format default to SDL_BLENDMODE_BLEND
Fixes https://github.com/libsdl-org/SDL/issues/9941
2024-07-16 18:50:22 -07:00
Sam Lantinga
2db57e2678 Removed SlowBlitPixelAccess_Unknown
This wasn't actually set anywhere, and not needed.
2024-07-16 18:43:14 -07:00
Sam Lantinga
b5292bdec9 Added blend mode testing for 8-bit surfaces 2024-07-16 17:57:12 -07:00
Sam Lantinga
e41428d259 Added full blit feature support for 8-bit surfaces
Fixes https://github.com/libsdl-org/SDL/issues/8079
2024-07-16 17:57:12 -07:00
Sam Lantinga
b7ec2119dd Use a dither palette when converting RGB images to indexed formats 2024-07-16 17:57:12 -07:00
Sam Lantinga
626bb53772 Fail blits between indexed and RGB surfaces if there is no palette set 2024-07-16 17:57:12 -07:00
Sam Lantinga
9ca1792848 Renamed driverdata to internal
This was done to SDL_DisplayMode for consistency with SDL_Surface and gives it a type so we don't have to do casts in SDL code.

I considered switching to an ID and hashing the driver data, etc. but all of that involved a lot of internal code churn and this solution gives us flexibility in how we handle this in the future.

After consideration, I made this renaming global across the project, for consistency.

Fixes https://github.com/libsdl-org/SDL/issues/10198
2024-07-16 17:17:13 -07:00
SDL Wiki Bot
fe183872ee Sync SDL3 wiki -> header 2024-07-16 20:45:34 +00:00
Ryan C. Gordon
4dda785c69 gamepad: Several gamepad mapping functions now follow the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
ed1f93cd11 filesystem: SDL_Glob*Directory() functions now follow the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
52bf7ff42d filesystem: SDL_GetPrefPath() now follows the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
2321726ff1 filesystem: SDL_GetUserFolder() now follows the SDL_GetStringRule.
It also now caches at the higher level, so the platform-specific bits don't
change their interface much.

Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
d40b89dff6 clipboard: SDL_GetPrimarySelectionText() now follows the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
158fc459f1 clipboard: SDL_GetClipboardText() now follows the SDL_GetStringRule.
Reference Issue #10229.
2024-07-16 16:44:36 -04:00
Ryan C. Gordon
3bc81a81f5 filesystem: SDL_GetBasePath() now follows the SDL_GetStringRule.
It also now caches at the higher level, so the platform-specific bits don't
change their interface much.

A little code hygiene work was applied to some of the platform bits on top of
this.

Reference Issue #10229.
2024-07-16 16:44:36 -04:00
SDL Wiki Bot
d65a8146b9 Sync SDL3 wiki -> header 2024-07-16 19:03:15 +00:00
Sam Lantinga
4aeabb3c3b Made event and temporary string memory thread-local and added SDL_FreeEventMemory()
Fixes https://github.com/libsdl-org/SDL/issues/10283
2024-07-16 12:01:51 -07:00
Sam Lantinga
ec3bb4c029 Removed the need for SDL_CreateTLS()
This eliminates the tap dancing needed for allocating TLS slots, we'll automatically allocate them as needed, in a thread-safe way.
2024-07-16 12:01:51 -07:00
Ryan C. Gordon
1592452cad
video: Fixed remaining return 0 to use NULL in CreateDevice implementations. 2024-07-16 14:26:30 -04:00
Ryan C. Gordon
d78ef58b4b
offscreen: Don't ever use this backend unless explicitly requested.
Reference PR #10202.
2024-07-16 14:19:58 -04:00
Ryan C. Gordon
bc1ceb0883
dummyvideo: Change a thing returning a 0 pointer to return NULL instead. 2024-07-16 14:17:02 -04:00
Ryan C. Gordon
045f0456b1
dummyvideo: Change a thing using int to use SDL_bool instead. 2024-07-16 14:15:38 -04:00
huanhuan-jiang
723c1cc5b3 Print message in summary when a X11 or wayland video driver is not found 2024-07-16 11:02:57 -07:00
SDL Wiki Bot
70727d36b2 Sync SDL3 wiki -> header 2024-07-16 16:37:08 +00:00
Sam Lantinga
027671bedb SDL_GetWindowOpacity() directly returns the opacity instead of using an out parameter.
Fixes https://github.com/libsdl-org/SDL/issues/10286
2024-07-16 09:36:11 -07:00
Sam Lantinga
58270ef3f2 Finished renaming functions in SDL_system.h 2024-07-16 09:35:49 -07:00
Ryan C. Gordon
199e6929e5
README-macos: fixed some text. 2024-07-16 08:25:38 -04:00
SDL Wiki Bot
4ac67f5ba6 Sync SDL3 wiki -> header 2024-07-16 01:38:55 +00:00
Sam Lantinga
033df70d4c SDL_DelayNS() will attempt to sleep exactly the requested amount of time
This provides a highly accurate sleep function for your application, although you are still subject to being switched out occasionally.

Fixes https://github.com/libsdl-org/SDL/issues/10210
2024-07-15 18:38:09 -07:00
Sam Lantinga
54366181c3 Rename functions in SDL_system.h to match SDL 3.0 naming convention
Fixes https://github.com/libsdl-org/SDL/issues/10277
2024-07-15 16:27:48 -07:00
Bruce Mitchener
e38f971f46 Fix typos in cmake 2024-07-15 15:24:00 -07:00