mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-01-19 08:01:50 +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.SetNoSoftLightLevel();
|
||||
|
||||
int numpixels = width * height;
|
||||
uint8_t* scr = (uint8_t*)M_Malloc(numpixels * 3);
|
||||
TArray<uint8_t> scr(width * height * 3, true);
|
||||
screen->CopyScreenToBuffer(width, height, scr);
|
||||
|
||||
DoWriteSavePic(file, SS_RGB, scr, width, height, viewsector, screen->FlipSavePic());
|
||||
M_Free(scr);
|
||||
DoWriteSavePic(file, SS_RGB, scr.Data(), width, height, viewsector, screen->FlipSavePic());
|
||||
|
||||
// Switch back the screen render buffers
|
||||
screen->SetViewportRects(nullptr);
|
||||
|
|
Loading…
Reference in a new issue