- changed return value of CreatePalettedPixels.

The new struct will allpw return of static pixel data without reallocation and copying.
This commit is contained in:
Christoph Oelckers 2023-01-07 17:55:55 +01:00
commit 1a0aa95ff4
24 changed files with 103 additions and 84 deletions

View file

@ -185,7 +185,7 @@ public:
FJPEGTexture (int lumpnum, int width, int height);
int CopyPixels(FBitmap *bmp, int conversion) override;
TArray<uint8_t> CreatePalettedPixels(int conversion) override;
PalettedPixels CreatePalettedPixels(int conversion) override;
};
//==========================================================================
@ -259,7 +259,7 @@ FJPEGTexture::FJPEGTexture (int lumpnum, int width, int height)
//
//==========================================================================
TArray<uint8_t> FJPEGTexture::CreatePalettedPixels(int conversion)
PalettedPixels FJPEGTexture::CreatePalettedPixels(int conversion)
{
auto lump = fileSystem.OpenFileReader (SourceLump);
JSAMPLE *buff = NULL;
@ -267,7 +267,7 @@ TArray<uint8_t> FJPEGTexture::CreatePalettedPixels(int conversion)
jpeg_decompress_struct cinfo;
jpeg_error_mgr jerr;
TArray<uint8_t> Pixels(Width * Height, true);
PalettedPixels Pixels(Width * Height);
memset (Pixels.Data(), 0xBA, Width * Height);
cinfo.err = jpeg_std_error(&jerr);