mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-15 17:22:12 +00:00
dumb
This commit is contained in:
parent
e765b9400c
commit
892e650712
4 changed files with 13 additions and 15 deletions
|
@ -1082,14 +1082,14 @@ UINT8 *HWR_GetScreenshot(void)
|
|||
return buf;
|
||||
}
|
||||
|
||||
boolean HWR_Screenshot(const char *pathname, char **error)
|
||||
boolean HWR_Screenshot(const char *pathname)
|
||||
{
|
||||
boolean ret;
|
||||
UINT8 *buf = malloc(vid.width * vid.height * 3 * sizeof (*buf));
|
||||
|
||||
if (!buf)
|
||||
{
|
||||
*error = "Failed to allocate memory for HWR_Screenshot";
|
||||
CONS_Debug(DBG_RENDER, "HWR_Screenshot: Failed to allocate memory\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1097,7 +1097,7 @@ boolean HWR_Screenshot(const char *pathname, char **error)
|
|||
HWD.pfnReadRect(0, 0, vid.width, vid.height, vid.width * 3, (void *)buf);
|
||||
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL, &*error); // c_irl
|
||||
ret = M_SavePNG(pathname, buf, vid.width, vid.height, NULL);
|
||||
#else
|
||||
ret = saveTGA(pathname, buf, vid.width, vid.height);
|
||||
#endif
|
||||
|
|
|
@ -53,7 +53,7 @@ void HWR_DrawConsoleFill(INT32 x, INT32 y, INT32 w, INT32 h, UINT32 color, INT32
|
|||
void HWR_DrawPic(INT32 x,INT32 y,lumpnum_t lumpnum);
|
||||
|
||||
UINT8 *HWR_GetScreenshot(void);
|
||||
boolean HWR_Screenshot(const char *pathname, char **error);
|
||||
boolean HWR_Screenshot(const char *pathname);
|
||||
|
||||
void HWR_AddCommands(void);
|
||||
void HWR_CorrectSWTricks(void);
|
||||
|
|
18
src/m_misc.c
18
src/m_misc.c
|
@ -1285,9 +1285,8 @@ void M_StopMovie(void)
|
|||
* \param height Height of the picture.
|
||||
* \param palette Palette of image data.
|
||||
* \note if palette is NULL, BGR888 format
|
||||
* \param error Error string to return, if screenshot failed.
|
||||
*/
|
||||
boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette, char **error)
|
||||
boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette)
|
||||
{
|
||||
png_structp png_ptr;
|
||||
png_infop png_info_ptr;
|
||||
|
@ -1302,14 +1301,14 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const
|
|||
png_FILE = fopen(filename,"wb");
|
||||
if (!png_FILE)
|
||||
{
|
||||
*error = "Failed to open file for write";
|
||||
CONS_Debug(DBG_RENDER, "M_SavePNG: Error on opening %s for write\n", filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, PNG_error, PNG_warn);
|
||||
if (!png_ptr)
|
||||
{
|
||||
*error = "Failed to initialize libpng";
|
||||
CONS_Debug(DBG_RENDER, "M_SavePNG: Error on initialize libpng\n");
|
||||
fclose(png_FILE);
|
||||
remove(filename);
|
||||
return false;
|
||||
|
@ -1318,7 +1317,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const
|
|||
png_info_ptr = png_create_info_struct(png_ptr);
|
||||
if (!png_info_ptr)
|
||||
{
|
||||
*error = "Failed to allocate memory for libpng";
|
||||
CONS_Debug(DBG_RENDER, "M_SavePNG: Error on allocate for libpng\n");
|
||||
png_destroy_write_struct(&png_ptr, NULL);
|
||||
fclose(png_FILE);
|
||||
remove(filename);
|
||||
|
@ -1331,7 +1330,7 @@ boolean M_SavePNG(const char *filename, void *data, int width, int height, const
|
|||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
#endif
|
||||
{
|
||||
*error = "libpng write error";
|
||||
//CONS_Debug(DBG_RENDER, "libpng write error on %s\n", filename);
|
||||
png_destroy_write_struct(&png_ptr, &png_info_ptr);
|
||||
fclose(png_FILE);
|
||||
remove(filename);
|
||||
|
@ -1470,7 +1469,6 @@ void M_DoScreenShot(void)
|
|||
#if NUMSCREENS > 2
|
||||
const char *freename = NULL, *pathname = ".";
|
||||
boolean ret = false;
|
||||
char *error = "Unknown error";
|
||||
UINT8 *linear = NULL;
|
||||
|
||||
// Don't take multiple screenshots, obviously
|
||||
|
@ -1511,13 +1509,13 @@ void M_DoScreenShot(void)
|
|||
// save the pcx file
|
||||
#ifdef HWRENDER
|
||||
if (rendermode == render_opengl)
|
||||
ret = HWR_Screenshot(va(pandf,pathname,freename), &error);
|
||||
ret = HWR_Screenshot(va(pandf,pathname,freename));
|
||||
else
|
||||
#endif
|
||||
{
|
||||
M_CreateScreenShotPalette();
|
||||
#ifdef USE_PNG
|
||||
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette, &error);
|
||||
ret = M_SavePNG(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette);
|
||||
#else
|
||||
ret = WritePCXfile(va(pandf,pathname,freename), linear, vid.width, vid.height, screenshot_palette);
|
||||
#endif
|
||||
|
@ -1532,7 +1530,7 @@ failure:
|
|||
else
|
||||
{
|
||||
if (freename)
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot %s in %s (%s)\n"), freename, pathname, error);
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot %s in %s\n"), freename, pathname);
|
||||
else
|
||||
CONS_Alert(CONS_ERROR, M_GetText("Couldn't create screen shot in %s (all 10000 slots used!)\n"), pathname);
|
||||
|
||||
|
|
|
@ -64,7 +64,7 @@ void FIL_ForceExtension(char *path, const char *extension);
|
|||
boolean FIL_CheckExtension(const char *in);
|
||||
|
||||
#ifdef HAVE_PNG
|
||||
boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette, char **error);
|
||||
boolean M_SavePNG(const char *filename, void *data, int width, int height, const UINT8 *palette);
|
||||
#endif
|
||||
|
||||
extern boolean takescreenshot;
|
||||
|
|
Loading…
Reference in a new issue