mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 09:11:48 +00:00
Avoid recreating the color LUT mid-recording-frame
This commit is contained in:
parent
0af71fafc5
commit
c3f0e6aa44
3 changed files with 17 additions and 12 deletions
|
@ -33,6 +33,7 @@ consvar_t cv_gif_downscale = {"gif_downscale", "On", CV_SAVE, CV_OnOff, NULL, 0
|
|||
#ifdef HAVE_ANIGIF
|
||||
static boolean gif_optimize = false; // So nobody can do something dumb
|
||||
static boolean gif_downscale = false; // like changing cvars mid output
|
||||
static RGBA_t *gif_palette = NULL;
|
||||
|
||||
static FILE *gif_out = NULL;
|
||||
static INT32 gif_frames = 0;
|
||||
|
@ -432,13 +433,7 @@ static void GIF_headwrite(void)
|
|||
|
||||
// write color table
|
||||
{
|
||||
RGBA_t *pal = ((cv_screenshot_colorprofile.value
|
||||
#ifdef HWRENDER
|
||||
&& (rendermode == render_soft)
|
||||
#endif
|
||||
) ? pLocalPalette
|
||||
: pMasterPalette);
|
||||
|
||||
RGBA_t *pal = gif_palette;
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
WRITEUINT8(p, pal[i].s.red);
|
||||
|
@ -473,7 +468,7 @@ static void hwrconvert(void)
|
|||
INT32 x, y;
|
||||
size_t i = 0;
|
||||
|
||||
InitColorLUT();
|
||||
InitColorLUT(gif_palette);
|
||||
|
||||
for (y = 0; y < vid.height; y++)
|
||||
{
|
||||
|
@ -643,6 +638,16 @@ INT32 GIF_open(const char *filename)
|
|||
|
||||
gif_optimize = (!!cv_gif_optimize.value);
|
||||
gif_downscale = (!!cv_gif_downscale.value);
|
||||
|
||||
// GIF color table
|
||||
// In hardware mode, uses the master palette
|
||||
gif_palette = ((cv_screenshot_colorprofile.value
|
||||
#ifdef HWRENDER
|
||||
&& (rendermode == render_soft)
|
||||
#endif
|
||||
) ? pLocalPalette
|
||||
: pMasterPalette);
|
||||
|
||||
GIF_headwrite();
|
||||
gif_frames = 0;
|
||||
return 1;
|
||||
|
|
|
@ -3251,19 +3251,19 @@ Unoptimized version
|
|||
|
||||
UINT8 colorlookup[CLUTSIZE][CLUTSIZE][CLUTSIZE];
|
||||
|
||||
void InitColorLUT(void)
|
||||
void InitColorLUT(RGBA_t *palette)
|
||||
{
|
||||
UINT8 r, g, b;
|
||||
static boolean clutinit = false;
|
||||
static RGBA_t *lastpalette = NULL;
|
||||
if ((!clutinit) || (lastpalette != pLocalPalette))
|
||||
if ((!clutinit) || (lastpalette != palette))
|
||||
{
|
||||
for (r = 0; r < CLUTSIZE; r++)
|
||||
for (g = 0; g < CLUTSIZE; g++)
|
||||
for (b = 0; b < CLUTSIZE; b++)
|
||||
colorlookup[r][g][b] = NearestColor(r << SHIFTCOLORBITS, g << SHIFTCOLORBITS, b << SHIFTCOLORBITS);
|
||||
clutinit = true;
|
||||
lastpalette = pLocalPalette;
|
||||
lastpalette = palette;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ void V_Init(void);
|
|||
|
||||
extern UINT8 colorlookup[CLUTSIZE][CLUTSIZE][CLUTSIZE];
|
||||
|
||||
void InitColorLUT(void);
|
||||
void InitColorLUT(RGBA_t *palette);
|
||||
|
||||
// Set the current RGB palette lookup to use for palettized graphics
|
||||
void V_SetPalette(INT32 palettenum);
|
||||
|
|
Loading…
Reference in a new issue