larger font hack + linear texture filter for images

This commit is contained in:
2024-01-21 13:58:22 +01:00
parent b1062e701e
commit e76e56e025
5 changed files with 33 additions and 5 deletions

View File

@ -7,7 +7,7 @@ SDLRendererTextureUploader::SDLRendererTextureUploader(SDL_Renderer* renderer_)
{
}
uint64_t SDLRendererTextureUploader::uploadRGBA(const uint8_t* data, uint32_t width, uint32_t height) {
uint64_t SDLRendererTextureUploader::uploadRGBA(const uint8_t* data, uint32_t width, uint32_t height, Filter filter) {
// TODO: test if pitch is 4 or 4*width
SDL_Surface* surf = SDL_CreateSurfaceFrom(
(void*)data,
@ -17,6 +17,13 @@ uint64_t SDLRendererTextureUploader::uploadRGBA(const uint8_t* data, uint32_t wi
);
assert(surf); // TODO: add error reporting
// TODO: this touches global state, reset?
if (filter == NEAREST) {
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
} else if (filter == LINEAR) {
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
}
SDL_Texture* tex = SDL_CreateTextureFromSurface(renderer, surf);
assert(tex); // TODO: add error reporting