- a few more buffers converted.

This commit is contained in:
Christoph Oelckers 2018-11-10 14:18:34 +01:00
parent 6894912f44
commit 4d06c17a44
2 changed files with 7 additions and 13 deletions

View File

@ -150,9 +150,9 @@ void FConsoleBuffer::AddText(int printlevel, const char *text, FILE *logfile)
void FConsoleBuffer::WriteLineToLog(FILE *LogFile, const char *outline)
{
// Strip out any color escape sequences before writing to the log file
char * copy = new char[strlen(outline)+1];
TArray<char> copy(strlen(outline)+1);
const char * srcp = outline;
char * dstp = copy;
char * dstp = copy.Data();
while (*srcp != 0)
{
@ -193,8 +193,7 @@ void FConsoleBuffer::WriteLineToLog(FILE *LogFile, const char *outline)
}
*dstp=0;
fputs (copy, LogFile);
delete [] copy;
fputs (copy.Data(), LogFile);
fflush (LogFile);
}

View File

@ -32,29 +32,24 @@
class FBurnTexture : public FTexture
{
uint32_t *WorkBuffer;
TArray<uint32_t> WorkBuffer;
public:
FBurnTexture(int w, int h)
: WorkBuffer(w*h, true)
{
Width = w;
Height = h;
WorkBuffer = new uint32_t[w * h];
}
~FBurnTexture()
{
delete [] WorkBuffer;
}
int CopyTrueColorPixels(FBitmap *bmp, int x, int y, int rotate, FCopyInfo *inf) override
{
bmp->CopyPixelDataRGB(x, y, (uint8_t*)WorkBuffer, Width, Height, 4, Width*4, rotate, CF_RGBA, inf);
bmp->CopyPixelDataRGB(x, y, (uint8_t*)WorkBuffer.Data(), Width, Height, 4, Width*4, rotate, CF_RGBA, inf);
return 0;
}
uint32_t *GetBuffer()
{
return WorkBuffer;
return WorkBuffer.Data();
}
};