1
0
Fork 0
forked from len0rd/rockbox

SDL: Migrate to SDL2

Incorporates large portions of g#5879 g#5282 g#5285 g#5286 g#5287

Differences from the above patches:

 * Removed all MacOS-specific stuff
 * Removed support for SDL1 entirely
 * Properly implement mousewheel support
 * Bumped up minimum stack size for sigalstack threading
 * Check for overflow before enqueing scrollwheel events

Tested on:

 * sdl application (Linux)
 * Simulator (x86_64, Linux) -- xduoox3/ipod4g/sansafuze
 * Simulator (i686, Windows) -- xduoox3
 * Simulator (arm64, Linux)

Change-Id: Ia3012dd1be123feb2888798a42d5b7cc149f382b
This commit is contained in:
Solomon Peachy 2024-09-21 16:31:20 -04:00
parent d13029ebdd
commit 7927423e34
49 changed files with 709 additions and 717 deletions

View file

@ -115,12 +115,17 @@ void sdl_gui_update(SDL_Surface *surface, int x_start, int y_start, int width,
(ui_y + y_start) * display_zoom,
width * display_zoom, height * display_zoom};
if (surface->flags & SDL_SRCALPHA) /* alpha needs a black background */
uint8_t alpha;
if (SDL_GetSurfaceAlphaMod(surface,&alpha) == 0 && alpha < 255)
SDL_FillRect(gui_surface, &dest, 0);
SDL_BlitSurface(surface, &src, gui_surface, &dest);
SDL_BlitSurface(surface, &src, gui_surface, &dest); /* alpha needs a black background */
SDL_Flip(gui_surface);
SDL_Texture *sdlTexture = SDL_CreateTextureFromSurface(sdlRenderer, gui_surface);
SDL_RenderClear(sdlRenderer);
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, NULL);
SDL_RenderPresent(sdlRenderer);
SDL_DestroyTexture(sdlTexture);
}
/* set a range of bitmap indices to a gradient from startcolour to endcolour */
@ -136,7 +141,7 @@ void sdl_set_gradient(SDL_Surface *surface, SDL_Color *start, SDL_Color *end,
palette[i].b = start->b + (end->b - start->b) * i / (steps - 1);
}
SDL_SetPalette(surface, SDL_LOGPAL|SDL_PHYSPAL, palette, first, steps);
SDL_SetPaletteColors(surface->format->palette, palette, first , steps);
}
int lcd_get_dpi(void)