From bcd7f893198a9683b133499b2f59e77c5a5287c0 Mon Sep 17 00:00:00 2001 From: Vladimir Olteanu Date: Mon, 13 Sep 2021 04:13:19 +0300 Subject: [PATCH] Have SDLWrap::AllocPalette allocate space for 256 colors by default --- Source/dx.cpp | 2 +- Source/storm/storm_svid.cpp | 2 +- Source/utils/sdl_wrap.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/dx.cpp b/Source/dx.cpp index 65d7180a6..ec041526e 100644 --- a/Source/dx.cpp +++ b/Source/dx.cpp @@ -236,7 +236,7 @@ void dx_reinit() void InitPalette() { - Palette = SDLWrap::AllocPalette(256); + Palette = SDLWrap::AllocPalette(); } void BltFast(SDL_Rect *srcRect, SDL_Rect *dstRect) diff --git a/Source/storm/storm_svid.cpp b/Source/storm/storm_svid.cpp index 63d1c060f..4fc9c7ed5 100644 --- a/Source/storm/storm_svid.cpp +++ b/Source/storm/storm_svid.cpp @@ -229,7 +229,7 @@ bool SVidPlayBegin(const char *filename, int flags) SVidWidth, SDL_PIXELFORMAT_INDEX8); - SVidPalette = SDLWrap::AllocPalette(256); + SVidPalette = SDLWrap::AllocPalette(); if (SDLC_SetSurfaceColors(SVidSurface.get(), SVidPalette.get()) <= -1) { ErrSdl(); } diff --git a/Source/utils/sdl_wrap.h b/Source/utils/sdl_wrap.h index e3ae3f15e..77f9ea8d1 100644 --- a/Source/utils/sdl_wrap.h +++ b/Source/utils/sdl_wrap.h @@ -60,7 +60,7 @@ inline SDLTextureUniquePtr CreateTexture(SDL_Renderer *renderer, Uint32 format, } #endif -inline SDLPaletteUniquePtr AllocPalette(int ncolors) +inline SDLPaletteUniquePtr AllocPalette(int ncolors = 256) { return SDLPaletteUniquePtr { NonNull(SDL_AllocPalette(ncolors)) }; }