Go to file
Simon McVittie d95d2d7051 SDLTest_CompareSurfaces: Decode pixels correctly on big-endian platforms
Previously, if acting on a surface with less than 32 bits per pixel,
this code was placing the pixel value from the surface in the first
few bytes of the Uint32 to be decoded, and unrelated data from a
subsequent pixel in the remaining bytes.

Because SDL_GetRGBA takes the bits to be decoded from the
least-significant bits of the given value, ignoring the higher-order
bits if any, this happened to be correct on little-endian platforms,
where the first few bytes store the least-significant bits of an
integer.

However, it was incorrect on big-endian, where the first few bytes are
the most-significant bits of an integer.

The previous implementation also assumed that unaligned access to a
32-bit quantity is possible, which is not the case on all CPUs (but
happens to be true on x86).

These issues were not discovered until now because
SDLTest_CompareSurfaces() is only used in testautomation, which until
recently was not being run routinely at build-time, because it contained
other assumptions that can fail in an autobuilder or CI environment.

Resolves: https://github.com/libsdl-org/SDL/issues/8315
Signed-off-by: Simon McVittie <smcv@collabora.com>
2023-09-29 06:55:17 -07:00
.github ci: make sure perl is installed + build docs with MSVC toolchain 2023-09-28 23:32:35 +02:00
VisualC Refactored SDL_audiocvt.c 2023-09-17 13:13:23 -07:00
VisualC-GDK Refactored SDL_audiocvt.c 2023-09-17 13:13:23 -07:00
VisualC-WinRT Visual-WinRT: dos2unix the project files to match other Visual Studio targets. 2023-09-22 23:08:46 -04:00
Xcode Added new audio files to the Xcode project 2023-09-17 13:16:19 -07:00
android-project Accept key events from any source 2023-08-24 10:09:02 -07:00
build-scripts build-scripts.pl: Added add-source-to-projects.pl 2023-09-22 23:08:46 -04:00
cmake cmake: make HEADERS_DIR a required argument of SDL_generate_manpages 2023-09-29 03:42:33 +02:00
docs Replaced SDL_GetGamepadBindForAxis() and SDL_GetGamepadBindForButton() with SDL_GetGamepadBindings() 2023-09-13 23:01:28 -07:00
include Bump libdecor feature check to look for 0.2.0 2023-09-25 12:07:54 -04:00
mingw/pkg-support/cmake build: don't add SDL3 subfolder to include path for external projects 2022-11-27 14:33:13 -08:00
src SDLTest_CompareSurfaces: Decode pixels correctly on big-endian platforms 2023-09-29 06:55:17 -07:00
test test: Accept small numerical differences in more mathematical tests 2023-09-28 09:37:12 -07:00
wayland-protocols Add and event and flag to report when a window has been occluded 2023-07-18 16:42:05 -04:00
.clang-format Commented out syntax that causes Visual Studio 2019 to complain on every edit 2022-12-02 00:43:01 -08:00
.clang-tidy Fix size of memcpy in SDL_AudioDeviceFormatChangedAlreadyLocked 2023-08-05 14:14:45 -04:00
.editorconfig Fixed formatting for Haiku cc files 2023-01-25 03:03:41 -08:00
.gitignore Add VS code directory to gitignore 2023-07-25 23:36:14 -07:00
.wikiheaders-options sdlwiki: SDL3 advises users to include through 'SDL3/SDL.h' 2023-03-21 02:19:19 +01:00
Android.mk Fixed building with the 16.1.4479499 Android toolchain 2023-06-13 07:50:00 -07:00
BUGS.txt Cleaned up a few more Bugzilla mentions. 2021-02-12 14:46:49 -05:00
CMakeLists.txt cmake: make HEADERS_DIR a required argument of SDL_generate_manpages 2023-09-29 03:42:33 +02:00
CREDITS.txt Use Apple's nomenclature for macOS and iOS 2022-11-25 16:00:06 -08:00
INSTALL.txt Use Apple's nomenclature for macOS and iOS 2022-11-25 16:00:06 -08:00
LICENSE.txt Updated copyright for 2023 2023-01-09 09:41:41 -08:00
README-SDL.txt More HTTPS changes in the documentation. 2017-02-16 16:52:03 -05:00
README.md Fixed typo 2023-08-31 09:32:39 -07:00
TODO.txt Fixed up legacy MoinMoin URLs at wiki.libsdl.org 2021-04-01 12:20:33 -04:00
WhatsNew.txt Removed patch note for change already in SDL 2.x 2023-07-08 09:35:42 -07:00

README.md

Simple DirectMedia Layer (SDL) Version 3.0

https://www.libsdl.org/

Simple DirectMedia Layer is a cross-platform development library designed to provide low level access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL and Direct3D. It is used by video playback software, emulators, and popular games including Valve's award winning catalog and many Humble Bundle games.

More extensive documentation is available in the docs directory, starting with README.md. If you are migrating to SDL 3.0 from SDL 2.0, the changes are extensively documented in README-migration.md.

Enjoy!

Sam Lantinga (slouken@libsdl.org)