update flake and code

This commit is contained in:
2024-07-18 12:22:15 +02:00
parent d6d91e61f4
commit 9fd2440ec6
5 changed files with 16 additions and 16 deletions

View File

@ -33,7 +33,7 @@ ImageLoaderSDLBMP::ImageResult ImageLoaderSDLBMP::loadFromMemoryRGBA(const uint8
return res;
}
SDL_Surface* conv_surf = SDL_ConvertSurfaceFormat(surf, SDL_PIXELFORMAT_RGBA32);
SDL_Surface* conv_surf = SDL_ConvertSurface(surf, SDL_PIXELFORMAT_RGBA32);
SDL_DestroySurface(surf);
if (conv_surf == nullptr) {
return res;

View File

@ -89,7 +89,7 @@ ImageLoaderSDLImage::ImageResult ImageLoaderSDLImage::loadFromMemoryRGBA(const u
}
for (int i = 0; i < anim->count; i++) {
SDL_Surface* conv_surf = SDL_ConvertSurfaceFormat(anim->frames[i], SDL_PIXELFORMAT_RGBA32);
SDL_Surface* conv_surf = SDL_ConvertSurface(anim->frames[i], SDL_PIXELFORMAT_RGBA32);
if (conv_surf == nullptr) {
return res;
}

View File

@ -14,16 +14,16 @@ SDLRendererTextureUploader::SDLRendererTextureUploader(SDL_Renderer* renderer_)
uint64_t SDLRendererTextureUploader::uploadRGBA(const uint8_t* data, uint32_t width, uint32_t height, Filter filter, Access access) {
// TODO: test if pitch is 4 or 4*width
SDL_Surface* surf = SDL_CreateSurfaceFrom(
(void*)data,
width, height,
4*width,
SDL_PIXELFORMAT_RGBA32 // auto big/little
SDL_PIXELFORMAT_RGBA32, // auto big/little
(void*)data,
4*width
);
assert(surf); // TODO: add error reporting
SDL_Texture* tex = SDL_CreateTexture(
renderer,
surf->format->format,
surf->format,
access == Access::STREAMING ? SDL_TEXTUREACCESS_STREAMING : SDL_TEXTUREACCESS_STATIC,
surf->w, surf->h
);