parent
0952b94d3f
commit
00d08c851f
6 changed files with 511 additions and 596 deletions
|
|
@ -1459,8 +1459,6 @@ void D_SRB2Main(void)
|
|||
CV_RegisterVar(&cv_constextsize);
|
||||
}
|
||||
|
||||
I_RegisterSysCommands();
|
||||
|
||||
#ifdef HWRENDER
|
||||
// Lactozilla: Add every hardware mode CVAR and CCMD.
|
||||
// Has to be done before the configuration file loads,
|
||||
|
|
|
|||
|
|
@ -174,7 +174,5 @@ char *I_ClipboardPaste(void)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
void I_RegisterSysCommands(void) {}
|
||||
|
||||
#include "../sdl/dosstr.c"
|
||||
|
||||
|
|
|
|||
|
|
@ -326,8 +326,6 @@ INT32 I_ClipboardCopy(const char *data, size_t size);
|
|||
*/
|
||||
const char *I_ClipboardPaste(void);
|
||||
|
||||
void I_RegisterSysCommands(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -57,6 +57,13 @@ static precise_t gif_prevframetime = 0;
|
|||
static UINT32 gif_delayus = 0; // "us" is microseconds
|
||||
static UINT8 gif_writeover = 0;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void *pixels;
|
||||
size_t size;
|
||||
boolean owns_pixels;
|
||||
} gif_screen_t;
|
||||
static gif_screen_t gif_screens[2];
|
||||
|
||||
|
||||
// OPTIMIZE gif output
|
||||
|
|
@ -541,7 +548,8 @@ static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr)
|
|||
static void GIF_framewrite(void)
|
||||
{
|
||||
UINT8 *p;
|
||||
UINT8 *movie_screen = screens[2];
|
||||
UINT8 *base_screen = gif_screens[0].pixels;
|
||||
UINT8 *movie_screen = gif_screens[1].pixels;
|
||||
INT32 blitx, blity, blitw, blith;
|
||||
boolean palchanged;
|
||||
|
||||
|
|
@ -566,7 +574,7 @@ static void GIF_framewrite(void)
|
|||
if (gif_optimize && gif_frames > 0 && (!palchanged))
|
||||
{
|
||||
// before blit movie_screen points to last frame, cur_screen points to this frame
|
||||
UINT8 *cur_screen = screens[0];
|
||||
UINT8 *cur_screen = base_screen;
|
||||
GIF_optimizeregion(cur_screen, movie_screen, &blitx, &blity, &blitw, &blith);
|
||||
|
||||
// blit to temp screen
|
||||
|
|
@ -576,7 +584,7 @@ static void GIF_framewrite(void)
|
|||
else if (rendermode == render_opengl)
|
||||
{
|
||||
UINT8 *linear = HWR_GetScreenshot();
|
||||
GIF_rgbconvert(linear, movie_screen);
|
||||
GIF_rgbconvert(linear, base_screen);
|
||||
//free(linear); // Allocated 'statically', no need to free now
|
||||
}
|
||||
#endif
|
||||
|
|
@ -602,7 +610,7 @@ static void GIF_framewrite(void)
|
|||
if (gif_frames == 0 && rendermode == render_soft)
|
||||
I_ReadScreen(movie_screen);
|
||||
|
||||
movie_screen = screens[0];
|
||||
movie_screen = base_screen;
|
||||
}
|
||||
|
||||
// screen regions are handled in GIF_lzw
|
||||
|
|
@ -750,13 +758,66 @@ INT32 GIF_open(const char *filename)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static void GIF_checkscreens(void)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(gif_screens) / sizeof(gif_screens[0]); i++)
|
||||
{
|
||||
if (rendermode == render_soft)
|
||||
{
|
||||
if (gif_screens[i].owns_pixels)
|
||||
{
|
||||
Z_Free(gif_screens[i].pixels);
|
||||
gif_screens[i].owns_pixels = false;
|
||||
}
|
||||
|
||||
gif_screens[i].size = 0;
|
||||
|
||||
if (i == 1)
|
||||
gif_screens[i].pixels = screens[2];
|
||||
else
|
||||
gif_screens[i].pixels = screens[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t sz = vid.width * vid.height * vid.bpp;
|
||||
|
||||
if (!gif_screens[i].owns_pixels)
|
||||
{
|
||||
gif_screens[i].size = sz;
|
||||
gif_screens[i].pixels = Z_Malloc(gif_screens[i].size, PU_STATIC, NULL);
|
||||
gif_screens[i].owns_pixels = true;
|
||||
}
|
||||
else if (gif_screens[i].size != sz)
|
||||
{
|
||||
gif_screens[i].size = sz;
|
||||
gif_screens[i].pixels = Z_Realloc(gif_screens[i].pixels, gif_screens[i].size, PU_STATIC, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void GIF_freescreens(void)
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(gif_screens) / sizeof(gif_screens[0]); i++)
|
||||
{
|
||||
if (gif_screens[i].owns_pixels)
|
||||
{
|
||||
Z_Free(gif_screens[i].pixels);
|
||||
gif_screens[i].owns_pixels = false;
|
||||
}
|
||||
|
||||
gif_screens[i].size = 0;
|
||||
gif_screens[i].pixels = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// GIF_frame
|
||||
// writes a frame into the output gif
|
||||
//
|
||||
void GIF_frame(void)
|
||||
{
|
||||
// there's not much actually needed here, is there.
|
||||
GIF_checkscreens();
|
||||
GIF_framewrite();
|
||||
}
|
||||
|
||||
|
|
@ -786,6 +847,8 @@ INT32 GIF_close(void)
|
|||
Z_Free(giflzw_hashTable);
|
||||
giflzw_hashTable = NULL;
|
||||
|
||||
GIF_freescreens();
|
||||
|
||||
CONS_Printf(M_GetText("Animated gif closed; wrote %d frames\n"), gif_frames);
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2681,7 +2681,4 @@ UINT32 I_GetFreeMem(UINT32 *total)
|
|||
#endif
|
||||
}
|
||||
|
||||
// note CPUAFFINITY code used to reside here
|
||||
//void I_RegisterSysCommands(void) {}
|
||||
|
||||
#endif // HAVE_SDL
|
||||
|
|
|
|||
1025
src/sdl/i_video.cpp
1025
src/sdl/i_video.cpp
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue