mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-12-03 17:02:12 +00:00
Precache, Unload and FillSimplePoly bug fix
This commit is contained in:
parent
3ce2d8365d
commit
8ba6a4f175
22 changed files with 33 additions and 52 deletions
|
@ -35,7 +35,6 @@ public:
|
||||||
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
bool CheckModified ();
|
bool CheckModified ();
|
||||||
void Unload ();
|
|
||||||
|
|
||||||
void SetVial (int level);
|
void SetVial (int level);
|
||||||
|
|
||||||
|
@ -90,10 +89,6 @@ bool FHealthBar::CheckModified ()
|
||||||
return NeedRefresh;
|
return NeedRefresh;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FHealthBar::Unload ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
const BYTE *FHealthBar::GetColumn (unsigned int column, const Span **spans_out)
|
const BYTE *FHealthBar::GetColumn (unsigned int column, const Span **spans_out)
|
||||||
{
|
{
|
||||||
if (NeedRefresh)
|
if (NeedRefresh)
|
||||||
|
|
|
@ -78,7 +78,6 @@ public:
|
||||||
|
|
||||||
const BYTE *GetColumn(unsigned int column, const Span **spans_out);
|
const BYTE *GetColumn(unsigned int column, const Span **spans_out);
|
||||||
const BYTE *GetPixels();
|
const BYTE *GetPixels();
|
||||||
void Unload();
|
|
||||||
bool CheckModified();
|
bool CheckModified();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -212,10 +211,6 @@ bool FBackdropTexture::CheckModified()
|
||||||
return LastRenderTic != gametic;
|
return LastRenderTic != gametic;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FBackdropTexture::Unload()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
|
|
|
@ -87,9 +87,9 @@ void FSoftwareRenderer::PrecacheTexture(FTexture *tex, int cache)
|
||||||
if (cache & FTextureManager::HIT_Columnmode)
|
if (cache & FTextureManager::HIT_Columnmode)
|
||||||
{
|
{
|
||||||
const FTexture::Span *spanp;
|
const FTexture::Span *spanp;
|
||||||
/*if (r_swtruecolor)
|
if (r_swtruecolor)
|
||||||
tex->GetColumnBgra(0, &spanp);
|
tex->GetColumnBgra(0, &spanp);
|
||||||
else*/
|
else
|
||||||
tex->GetColumn(0, &spanp);
|
tex->GetColumn(0, &spanp);
|
||||||
}
|
}
|
||||||
else if (cache != 0)
|
else if (cache != 0)
|
||||||
|
|
|
@ -122,6 +122,7 @@ void FAutomapTexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -56,7 +56,6 @@ public:
|
||||||
|
|
||||||
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
void Unload ();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const BYTE *Pixels;
|
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 ()
|
const BYTE *FBuildTexture::GetPixels ()
|
||||||
{
|
{
|
||||||
return Pixels;
|
return Pixels;
|
||||||
|
|
|
@ -183,6 +183,8 @@ void FCanvasTexture::Unload ()
|
||||||
CanvasBgra->Destroy();
|
CanvasBgra->Destroy();
|
||||||
CanvasBgra = NULL;
|
CanvasBgra = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FCanvasTexture::CheckModified ()
|
bool FCanvasTexture::CheckModified ()
|
||||||
|
|
|
@ -401,6 +401,7 @@ void FDDSTexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -138,6 +138,7 @@ void FFlatTexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -142,6 +142,7 @@ void FIMGZTexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -196,7 +196,6 @@ public:
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
BYTE *Pixels;
|
BYTE *Pixels;
|
||||||
std::vector<uint32_t> PixelsBgra;
|
|
||||||
Span DummySpans[2];
|
Span DummySpans[2];
|
||||||
|
|
||||||
void MakeTexture ();
|
void MakeTexture ();
|
||||||
|
@ -300,7 +299,7 @@ void FJPEGTexture::Unload ()
|
||||||
{
|
{
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
PixelsBgra.clear();
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -362,6 +362,7 @@ void FMultiPatchTexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -184,6 +184,7 @@ void FPatchTexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -191,6 +191,7 @@ void FPCXTexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -67,7 +67,6 @@ protected:
|
||||||
|
|
||||||
FString SourceFile;
|
FString SourceFile;
|
||||||
BYTE *Pixels;
|
BYTE *Pixels;
|
||||||
std::vector<uint32_t> PixelsBgra;
|
|
||||||
Span **Spans;
|
Span **Spans;
|
||||||
|
|
||||||
BYTE BitDepth;
|
BYTE BitDepth;
|
||||||
|
@ -382,7 +381,7 @@ void FPNGTexture::Unload ()
|
||||||
{
|
{
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
PixelsBgra.clear();
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -206,6 +206,7 @@ void FRawPageTexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -176,6 +176,11 @@ FTexture::~FTexture ()
|
||||||
KillNative();
|
KillNative();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FTexture::Unload()
|
||||||
|
{
|
||||||
|
PixelsBgra = std::vector<uint32_t>();
|
||||||
|
}
|
||||||
|
|
||||||
const uint32_t *FTexture::GetColumnBgra(unsigned int column, const Span **spans_out)
|
const uint32_t *FTexture::GetColumnBgra(unsigned int column, const Span **spans_out)
|
||||||
{
|
{
|
||||||
const uint32_t *pixels = GetPixelsBgra();
|
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()
|
const uint32_t *FTexture::GetPixelsBgra()
|
||||||
{
|
{
|
||||||
if (BgraPixels.empty())
|
if (PixelsBgra.empty())
|
||||||
{
|
{
|
||||||
|
GetColumn(0, nullptr);
|
||||||
const BYTE *indices = GetPixels();
|
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++)
|
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 ()
|
bool FTexture::CheckModified ()
|
||||||
|
@ -642,10 +650,6 @@ FDummyTexture::FDummyTexture ()
|
||||||
UseType = TEX_Null;
|
UseType = TEX_Null;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FDummyTexture::Unload ()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void FDummyTexture::SetSize (int width, int height)
|
void FDummyTexture::SetSize (int width, int height)
|
||||||
{
|
{
|
||||||
Width = width;
|
Width = width;
|
||||||
|
|
|
@ -192,7 +192,7 @@ public:
|
||||||
virtual FTexture *GetRedirect(bool wantwarped);
|
virtual FTexture *GetRedirect(bool wantwarped);
|
||||||
virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override
|
virtual FTexture *GetRawTexture(); // for FMultiPatchTexture to override
|
||||||
|
|
||||||
virtual void Unload () = 0;
|
virtual void Unload ();
|
||||||
|
|
||||||
// Returns the native pixel format for this image
|
// Returns the native pixel format for this image
|
||||||
virtual FTextureFormat GetFormat();
|
virtual FTextureFormat GetFormat();
|
||||||
|
@ -269,8 +269,7 @@ protected:
|
||||||
Rotations = other->Rotations;
|
Rotations = other->Rotations;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
std::vector<uint32_t> PixelsBgra;
|
||||||
std::vector<uint32_t> BgraPixels;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static void FlipSquareBlock (BYTE *block, int x, int y);
|
static void FlipSquareBlock (BYTE *block, int x, int y);
|
||||||
|
@ -472,7 +471,6 @@ public:
|
||||||
FDummyTexture ();
|
FDummyTexture ();
|
||||||
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
const BYTE *GetColumn (unsigned int column, const Span **spans_out);
|
||||||
const BYTE *GetPixels ();
|
const BYTE *GetPixels ();
|
||||||
void Unload ();
|
|
||||||
void SetSize (int width, int height);
|
void SetSize (int width, int height);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -181,6 +181,7 @@ void FTGATexture::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -74,6 +74,7 @@ void FWarpTexture::Unload ()
|
||||||
Spans = NULL;
|
Spans = NULL;
|
||||||
}
|
}
|
||||||
SourcePic->Unload ();
|
SourcePic->Unload ();
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FWarpTexture::CheckModified ()
|
bool FWarpTexture::CheckModified ()
|
||||||
|
|
|
@ -1403,7 +1403,7 @@ void DCanvas::FillSimplePoly(FTexture *tex, FVector2 *points, int npoints,
|
||||||
R_SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
|
R_SetSpanColormap(colormap, clamp(shade >> FRACBITS, 0, NUMCOLORMAPS - 1));
|
||||||
else
|
else
|
||||||
R_SetSpanColormap(&identitycolormap, 0);
|
R_SetSpanColormap(&identitycolormap, 0);
|
||||||
R_SetSpanSource(tex->GetPixels());
|
R_SetSpanSource(r_swtruecolor ? (const BYTE*)tex->GetPixelsBgra() : tex->GetPixels());
|
||||||
scalex = double(1u << (32 - ds_xbits)) / scalex;
|
scalex = double(1u << (32 - ds_xbits)) / scalex;
|
||||||
scaley = double(1u << (32 - ds_ybits)) / scaley;
|
scaley = double(1u << (32 - ds_ybits)) / scaley;
|
||||||
ds_xstep = xs_RoundToInt(cosrot * scalex);
|
ds_xstep = xs_RoundToInt(cosrot * scalex);
|
||||||
|
|
|
@ -1662,6 +1662,7 @@ void FFontChar1::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
@ -1723,6 +1724,7 @@ void FFontChar2::Unload ()
|
||||||
delete[] Pixels;
|
delete[] Pixels;
|
||||||
Pixels = NULL;
|
Pixels = NULL;
|
||||||
}
|
}
|
||||||
|
FTexture::Unload();
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
|
|
|
@ -117,7 +117,6 @@ public:
|
||||||
|
|
||||||
const BYTE *GetColumn(unsigned int column, const Span **spans_out);
|
const BYTE *GetColumn(unsigned int column, const Span **spans_out);
|
||||||
const BYTE *GetPixels();
|
const BYTE *GetPixels();
|
||||||
void Unload();
|
|
||||||
bool CheckModified();
|
bool CheckModified();
|
||||||
void SetTranslation(int num);
|
void SetTranslation(int num);
|
||||||
|
|
||||||
|
@ -1076,16 +1075,6 @@ void FPaletteTester::SetTranslation(int num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//==========================================================================
|
|
||||||
//
|
|
||||||
// FPaletteTester :: Unload
|
|
||||||
//
|
|
||||||
//==========================================================================
|
|
||||||
|
|
||||||
void FPaletteTester::Unload()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
//==========================================================================
|
//==========================================================================
|
||||||
//
|
//
|
||||||
// FPaletteTester :: GetColumn
|
// FPaletteTester :: GetColumn
|
||||||
|
|
Loading…
Reference in a new issue