Fix OpenGL only recording the first frame of unoptimized GIFs
This commit is contained in:
parent
38232ce07e
commit
ab7987d1cf
|
@ -490,29 +490,28 @@ const UINT8 gifframe_gchead[4] = {0x21,0xF9,0x04,0x04}; // GCE, bytes, packed by
|
||||||
static UINT8 *gifframe_data = NULL;
|
static UINT8 *gifframe_data = NULL;
|
||||||
static size_t gifframe_size = 8192;
|
static size_t gifframe_size = 8192;
|
||||||
|
|
||||||
|
//
|
||||||
|
// GIF_rgbconvert
|
||||||
|
// converts an RGB frame to a frame with a palette.
|
||||||
|
//
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
static void hwrconvert(void)
|
static void GIF_rgbconvert(UINT8 *linear, UINT8 *scr)
|
||||||
{
|
{
|
||||||
UINT8 *linear = HWR_GetScreenshot();
|
|
||||||
UINT8 *dest = screens[2];
|
|
||||||
UINT8 r, g, b;
|
UINT8 r, g, b;
|
||||||
INT32 x, y;
|
size_t src = 0, dest = 0;
|
||||||
size_t i = 0;
|
size_t size = (vid.width * vid.height * 3);
|
||||||
|
|
||||||
InitColorLUT(gif_framepalette);
|
InitColorLUT(gif_framepalette);
|
||||||
|
|
||||||
for (y = 0; y < vid.height; y++)
|
while (src < size)
|
||||||
{
|
{
|
||||||
for (x = 0; x < vid.width; x++, i += 3)
|
r = (UINT8)linear[src];
|
||||||
{
|
g = (UINT8)linear[src + 1];
|
||||||
r = (UINT8)linear[i];
|
b = (UINT8)linear[src + 2];
|
||||||
g = (UINT8)linear[i + 1];
|
scr[dest] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS];
|
||||||
b = (UINT8)linear[i + 2];
|
src += (3 * scrbuf_downscaleamt);
|
||||||
dest[(y * vid.width) + x] = colorlookup[r >> SHIFTCOLORBITS][g >> SHIFTCOLORBITS][b >> SHIFTCOLORBITS];
|
dest += scrbuf_downscaleamt;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
free(linear);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -556,7 +555,11 @@ static void GIF_framewrite(void)
|
||||||
I_ReadScreen(movie_screen);
|
I_ReadScreen(movie_screen);
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
else if (rendermode == render_opengl)
|
else if (rendermode == render_opengl)
|
||||||
hwrconvert();
|
{
|
||||||
|
UINT8 *linear = HWR_GetScreenshot();
|
||||||
|
GIF_rgbconvert(linear, movie_screen);
|
||||||
|
free(linear);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -565,18 +568,20 @@ static void GIF_framewrite(void)
|
||||||
blitw = vid.width;
|
blitw = vid.width;
|
||||||
blith = vid.height;
|
blith = vid.height;
|
||||||
|
|
||||||
if (gif_frames == 0)
|
|
||||||
{
|
|
||||||
if (rendermode == render_soft)
|
|
||||||
I_ReadScreen(movie_screen);
|
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
else if (rendermode == render_opengl)
|
// Copy the current OpenGL frame into the base screen
|
||||||
{
|
if (rendermode == render_opengl)
|
||||||
hwrconvert();
|
{
|
||||||
VID_BlitLinearScreen(screens[2], screens[0], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes);
|
UINT8 *linear = HWR_GetScreenshot();
|
||||||
}
|
GIF_rgbconvert(linear, screens[0]);
|
||||||
#endif
|
free(linear);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Copy the first frame into the movie screen
|
||||||
|
// OpenGL already does the same above.
|
||||||
|
if (gif_frames == 0 && rendermode == render_soft)
|
||||||
|
I_ReadScreen(movie_screen);
|
||||||
|
|
||||||
movie_screen = screens[0];
|
movie_screen = screens[0];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue