mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-19 16:11:23 +00:00
- get rid of M_Malloc call in WriteSavePic
Use TArray instead
This commit is contained in:
parent
b9501a7291
commit
5bae588f80
1 changed files with 2 additions and 4 deletions
|
@ -284,12 +284,10 @@ void WriteSavePic(player_t* player, FileWriter* file, int width, int height)
|
||||||
RenderState.EnableStencil(false);
|
RenderState.EnableStencil(false);
|
||||||
RenderState.SetNoSoftLightLevel();
|
RenderState.SetNoSoftLightLevel();
|
||||||
|
|
||||||
int numpixels = width * height;
|
TArray<uint8_t> scr(width * height * 3, true);
|
||||||
uint8_t* scr = (uint8_t*)M_Malloc(numpixels * 3);
|
|
||||||
screen->CopyScreenToBuffer(width, height, scr);
|
screen->CopyScreenToBuffer(width, height, scr);
|
||||||
|
|
||||||
DoWriteSavePic(file, SS_RGB, scr, width, height, viewsector, screen->FlipSavePic());
|
DoWriteSavePic(file, SS_RGB, scr.Data(), width, height, viewsector, screen->FlipSavePic());
|
||||||
M_Free(scr);
|
|
||||||
|
|
||||||
// Switch back the screen render buffers
|
// Switch back the screen render buffers
|
||||||
screen->SetViewportRects(nullptr);
|
screen->SetViewportRects(nullptr);
|
||||||
|
|
Loading…
Reference in a new issue