Precache, Unload and FillSimplePoly bug fix
This commit is contained in:
parent
3ce2d8365d
commit
8ba6a4f175
22 changed files with 33 additions and 52 deletions
|
|
@ -122,6 +122,7 @@ void FAutomapTexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -56,7 +56,6 @@ public:
|
|||
|
||||
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
||||
const BYTE *GetPixels ();
|
||||
void Unload ();
|
||||
|
||||
protected:
|
||||
const BYTE *Pixels;
|
||||
|
|
@ -103,17 +102,6 @@ FBuildTexture::~FBuildTexture ()
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
void FBuildTexture::Unload ()
|
||||
{
|
||||
// Nothing to do, since the pixels are accessed from memory-mapped files directly
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
const BYTE *FBuildTexture::GetPixels ()
|
||||
{
|
||||
return Pixels;
|
||||
|
|
|
|||
|
|
@ -183,6 +183,8 @@ void FCanvasTexture::Unload ()
|
|||
CanvasBgra->Destroy();
|
||||
CanvasBgra = NULL;
|
||||
}
|
||||
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
bool FCanvasTexture::CheckModified ()
|
||||
|
|
|
|||
|
|
@ -401,6 +401,7 @@ void FDDSTexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -138,6 +138,7 @@ void FFlatTexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -142,6 +142,7 @@ void FIMGZTexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -196,7 +196,6 @@ public:
|
|||
protected:
|
||||
|
||||
BYTE *Pixels;
|
||||
std::vector<uint32_t> PixelsBgra;
|
||||
Span DummySpans[2];
|
||||
|
||||
void MakeTexture ();
|
||||
|
|
@ -300,7 +299,7 @@ void FJPEGTexture::Unload ()
|
|||
{
|
||||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
PixelsBgra.clear();
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -362,6 +362,7 @@ void FMultiPatchTexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -184,6 +184,7 @@ void FPatchTexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -191,6 +191,7 @@ void FPCXTexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -67,7 +67,6 @@ protected:
|
|||
|
||||
FString SourceFile;
|
||||
BYTE *Pixels;
|
||||
std::vector<uint32_t> PixelsBgra;
|
||||
Span **Spans;
|
||||
|
||||
BYTE BitDepth;
|
||||
|
|
@ -382,7 +381,7 @@ void FPNGTexture::Unload ()
|
|||
{
|
||||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
PixelsBgra.clear();
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ void FRawPageTexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -176,6 +176,11 @@ FTexture::~FTexture ()
|
|||
KillNative();
|
||||
}
|
||||
|
||||
void FTexture::Unload()
|
||||
{
|
||||
PixelsBgra = std::vector<uint32_t>();
|
||||
}
|
||||
|
||||
const uint32_t *FTexture::GetColumnBgra(unsigned int column, const Span **spans_out)
|
||||
{
|
||||
const uint32_t *pixels = GetPixelsBgra();
|
||||
|
|
@ -189,16 +194,19 @@ const uint32_t *FTexture::GetColumnBgra(unsigned int column, const Span **spans_
|
|||
|
||||
const uint32_t *FTexture::GetPixelsBgra()
|
||||
{
|
||||
if (BgraPixels.empty())
|
||||
if (PixelsBgra.empty())
|
||||
{
|
||||
GetColumn(0, nullptr);
|
||||
const BYTE *indices = GetPixels();
|
||||
BgraPixels.resize(Width * Height);
|
||||
if (indices == nullptr)
|
||||
return nullptr;
|
||||
PixelsBgra.resize(Width * Height);
|
||||
for (int i = 0; i < Width * Height; i++)
|
||||
{
|
||||
BgraPixels[i] = GPalette.BaseColors[indices[i]].d;
|
||||
PixelsBgra[i] = GPalette.BaseColors[indices[i]].d;
|
||||
}
|
||||
}
|
||||
return BgraPixels.data();
|
||||
return PixelsBgra.data();
|
||||
}
|
||||
|
||||
bool FTexture::CheckModified ()
|
||||
|
|
@ -642,10 +650,6 @@ FDummyTexture::FDummyTexture ()
|
|||
UseType = TEX_Null;
|
||||
}
|
||||
|
||||
void FDummyTexture::Unload ()
|
||||
{
|
||||
}
|
||||
|
||||
void FDummyTexture::SetSize (int width, int height)
|
||||
{
|
||||
Width = width;
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ public:
|
|||
virtual FTexture *GetRedirect(bool wantwarped);
|
||||
virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override
|
||||
|
||||
virtual void Unload () = 0;
|
||||
virtual void Unload ();
|
||||
|
||||
// Returns the native pixel format for this image
|
||||
virtual FTextureFormat GetFormat();
|
||||
|
|
@ -269,8 +269,7 @@ protected:
|
|||
Rotations = other->Rotations;
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<uint32_t> BgraPixels;
|
||||
std::vector<uint32_t> PixelsBgra;
|
||||
|
||||
public:
|
||||
static void FlipSquareBlock (BYTE *block, int x, int y);
|
||||
|
|
@ -472,7 +471,6 @@ public:
|
|||
FDummyTexture ();
|
||||
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
||||
const BYTE *GetPixels ();
|
||||
void Unload ();
|
||||
void SetSize (int width, int height);
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -181,6 +181,7 @@ void FTGATexture::Unload ()
|
|||
delete[] Pixels;
|
||||
Pixels = NULL;
|
||||
}
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ void FWarpTexture::Unload ()
|
|||
Spans = NULL;
|
||||
}
|
||||
SourcePic->Unload ();
|
||||
FTexture::Unload();
|
||||
}
|
||||
|
||||
bool FWarpTexture::CheckModified ()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue