sdl (master post 3.1 preview) Merge commit 'e4f454091a943345938608570b104400f62fd625'

This commit is contained in:
2024-03-28 16:27:42 +01:00
862 changed files with 204894 additions and 45662 deletions

View File

@@ -29,7 +29,7 @@ GetNearbyFilename(const char *file)
base = SDL_GetBasePath();
if (base) {
SDL_RWops *rw;
SDL_IOStream *rw;
size_t len = SDL_strlen(base) + SDL_strlen(file) + 1;
path = SDL_malloc(len);
@@ -42,9 +42,9 @@ GetNearbyFilename(const char *file)
(void)SDL_snprintf(path, len, "%s%s", base, file);
SDL_free(base);
rw = SDL_RWFromFile(path, "rb");
rw = SDL_IOFromFile(path, "rb");
if (rw) {
SDL_RWclose(rw);
SDL_CloseIO(rw);
return path;
}
@@ -104,14 +104,14 @@ LoadTexture(SDL_Renderer *renderer, const char *file, SDL_bool transparent,
/* Set transparent pixel as the pixel at (0,0) */
if (transparent) {
if (temp->format->palette) {
const Uint8 bpp = temp->format->BitsPerPixel;
const Uint8 bpp = temp->format->bits_per_pixel;
const Uint8 mask = (1 << bpp) - 1;
if (SDL_PIXELORDER(temp->format->format) == SDL_BITMAPORDER_4321)
SDL_SetSurfaceColorKey(temp, SDL_TRUE, (*(Uint8 *)temp->pixels) & mask);
else
SDL_SetSurfaceColorKey(temp, SDL_TRUE, ((*(Uint8 *)temp->pixels) >> (8 - bpp)) & mask);
} else {
switch (temp->format->BitsPerPixel) {
switch (temp->format->bits_per_pixel) {
case 15:
SDL_SetSurfaceColorKey(temp, SDL_TRUE,
(*(Uint16 *)temp->pixels) & 0x00007FFF);