mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-22 04:21:23 +00:00
Implement I_ReadScreenTransposed
This commit is contained in:
parent
fd1ee9002d
commit
b048f6b6ff
6 changed files with 41 additions and 4 deletions
|
@ -87,6 +87,11 @@ void I_ReadScreen(UINT8 *scr)
|
||||||
(void)scr;
|
(void)scr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I_ReadScreenTransposed(UINT8 *scr)
|
||||||
|
{
|
||||||
|
(void)scr;
|
||||||
|
}
|
||||||
|
|
||||||
void I_BeginRead(void){}
|
void I_BeginRead(void){}
|
||||||
|
|
||||||
void I_EndRead(void){}
|
void I_EndRead(void){}
|
||||||
|
|
|
@ -75,6 +75,11 @@ void I_ReadScreen(UINT8 *scr)
|
||||||
(void)scr;
|
(void)scr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void I_ReadScreenTransposed(UINT8 *scr)
|
||||||
|
{
|
||||||
|
(void)scr;
|
||||||
|
}
|
||||||
|
|
||||||
void I_BeginRead(void){}
|
void I_BeginRead(void){}
|
||||||
|
|
||||||
void I_EndRead(void){}
|
void I_EndRead(void){}
|
||||||
|
|
|
@ -143,6 +143,14 @@ void I_WaitVBL(INT32 count);
|
||||||
*/
|
*/
|
||||||
void I_ReadScreen(UINT8 *scr);
|
void I_ReadScreen(UINT8 *scr);
|
||||||
|
|
||||||
|
/** \brief The I_ReadScreenTransposed function
|
||||||
|
|
||||||
|
\param scr buffer to copy screen to
|
||||||
|
|
||||||
|
\return void
|
||||||
|
*/
|
||||||
|
void I_ReadScreenTransposed(UINT8 *scr);
|
||||||
|
|
||||||
/** \brief Start disk icon
|
/** \brief Start disk icon
|
||||||
*/
|
*/
|
||||||
void I_BeginRead(void);
|
void I_BeginRead(void);
|
||||||
|
|
|
@ -565,7 +565,7 @@ static void GIF_framewrite(void)
|
||||||
|
|
||||||
// blit to temp screen
|
// blit to temp screen
|
||||||
if (rendermode == render_soft)
|
if (rendermode == render_soft)
|
||||||
I_ReadScreen(movie_screen);
|
I_ReadScreenTransposed(movie_screen);
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
else if (rendermode == render_opengl)
|
else if (rendermode == render_opengl)
|
||||||
{
|
{
|
||||||
|
@ -594,7 +594,7 @@ static void GIF_framewrite(void)
|
||||||
// Copy the first frame into the movie screen
|
// Copy the first frame into the movie screen
|
||||||
// OpenGL already does the same above.
|
// OpenGL already does the same above.
|
||||||
if (gif_frames == 0 && rendermode == render_soft)
|
if (gif_frames == 0 && rendermode == render_soft)
|
||||||
I_ReadScreen(movie_screen);
|
I_ReadScreenTransposed(movie_screen);
|
||||||
|
|
||||||
movie_screen = screens[0];
|
movie_screen = screens[0];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1280,7 +1280,7 @@ void M_SaveFrame(void)
|
||||||
{
|
{
|
||||||
// munge planar buffer to linear
|
// munge planar buffer to linear
|
||||||
linear = screens[2];
|
linear = screens[2];
|
||||||
I_ReadScreen(linear);
|
I_ReadScreenTransposed(linear);
|
||||||
}
|
}
|
||||||
#ifdef HWRENDER
|
#ifdef HWRENDER
|
||||||
else
|
else
|
||||||
|
@ -1590,7 +1590,7 @@ void M_DoScreenShot(void)
|
||||||
{
|
{
|
||||||
// munge planar buffer to linear
|
// munge planar buffer to linear
|
||||||
linear = screens[2];
|
linear = screens[2];
|
||||||
I_ReadScreen(linear);
|
I_ReadScreenTransposed(linear);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!freename)
|
if (!freename)
|
||||||
|
|
|
@ -1306,6 +1306,25 @@ void I_ReadScreen(UINT8 *scr)
|
||||||
vid.rowbytes, vid.rowbytes);
|
vid.rowbytes, vid.rowbytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// I_ReadScreenTransposed
|
||||||
|
// The screen buffers in SRB2 are transposed, meaning they are ordered by columns instead of rows.
|
||||||
|
// This function copies the buffer transposed so that it's arranged by rows, for things that expect the buffer to be that way.
|
||||||
|
//
|
||||||
|
void I_ReadScreenTransposed(UINT8 *scr)
|
||||||
|
{
|
||||||
|
if (rendermode != render_soft)
|
||||||
|
I_Error("I_ReadScreenTransposed: called while in non-software mode");
|
||||||
|
|
||||||
|
UINT8 *buffer = screens[0];
|
||||||
|
|
||||||
|
size_t dest_rowbytes = vid.width * vid.bpp;
|
||||||
|
|
||||||
|
for (int y = 0; y < vid.height; y++)
|
||||||
|
for (int x = 0; x < vid.width; x++)
|
||||||
|
scr[(y * dest_rowbytes) + x] = buffer[(x * vid.rowbytes) + y];
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// I_SetPalette
|
// I_SetPalette
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in a new issue