- split between textures and images is complete now.
* split up FMultiPatchTexture into a builder class and the actual image source. * since images can now be referenced by multiple textures the old redirection mechanism has been removed. It can be done better and less intrusive now. Simple single patch textures already directly reference the underlying patch image now. * allocate all image source related data from a memory arena. Since this is all static this makes it a lot easier to free this in bulk.
This commit is contained in:
parent
91f7121452
commit
4cedbf6cc2
16 changed files with 1136 additions and 1183 deletions
|
|
@ -246,54 +246,6 @@ void FTexture::SetFrontSkyLayer ()
|
|||
bNoRemap0 = true;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void FTexture::CopyToBlock (uint8_t *dest, int dwidth, int dheight, int xpos, int ypos, int rotate, const uint8_t *translation, bool style)
|
||||
{
|
||||
auto image = Get8BitPixels(style); // should use composition cache
|
||||
const uint8_t *pixels = image.Data();
|
||||
int srcwidth = Width;
|
||||
int srcheight = Height;
|
||||
int step_x = Height;
|
||||
int step_y = 1;
|
||||
FClipRect cr = {0, 0, dwidth, dheight};
|
||||
if (style) translation = nullptr; // do not apply translations to alpha textures.
|
||||
|
||||
if (ClipCopyPixelRect(&cr, xpos, ypos, pixels, srcwidth, srcheight, step_x, step_y, rotate))
|
||||
{
|
||||
dest += ypos + dheight * xpos;
|
||||
if (translation == NULL)
|
||||
{
|
||||
for (int x = 0; x < srcwidth; x++)
|
||||
{
|
||||
int pos = x * dheight;
|
||||
for (int y = 0; y < srcheight; y++, pos++)
|
||||
{
|
||||
// the optimizer is doing a good enough job here so there's no need to optimize this by hand
|
||||
uint8_t v = pixels[y * step_y + x * step_x];
|
||||
if (v != 0) dest[pos] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int x = 0; x < srcwidth; x++)
|
||||
{
|
||||
int pos = x * dheight;
|
||||
for (int y = 0; y < srcheight; y++, pos++)
|
||||
{
|
||||
uint8_t v = pixels[y * step_y + x * step_x];
|
||||
if (v != 0) dest[pos] = translation[v];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
// FTexture::CopyPixels
|
||||
|
|
@ -341,16 +293,6 @@ FBitmap FTexture::GetBgraBitmap(PalEntry *remap, int *ptrans)
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
bool FTexture::UseBasePalette()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
FTexture *FTexture::GetRedirect()
|
||||
{
|
||||
return this;
|
||||
}
|
||||
|
||||
FTexture *FTexture::GetRawTexture()
|
||||
{
|
||||
return this;
|
||||
|
|
@ -523,7 +465,7 @@ void FTexture::CreateDefaultBrightmap()
|
|||
if (!bBrightmapChecked)
|
||||
{
|
||||
// Check for brightmaps
|
||||
if (UseBasePalette() && TexMan.HasGlobalBrightmap &&
|
||||
if (GetImage() && GetImage()->UseGamePalette() && TexMan.HasGlobalBrightmap &&
|
||||
UseType != ETextureType::Decal && UseType != ETextureType::MiscPatch && UseType != ETextureType::FontChar &&
|
||||
Brightmap == NULL && bWarped == 0)
|
||||
{
|
||||
|
|
@ -779,11 +721,6 @@ bool FTexture::ProcessData(unsigned char * buffer, int w, int h, bool ispatch)
|
|||
if (bMasked)
|
||||
{
|
||||
bMasked = SmoothEdges(buffer, w, h);
|
||||
if (!bMasked)
|
||||
{
|
||||
auto stex = GetRedirect();
|
||||
stex->bMasked = false; // also clear in the base texture if there is a redirection.
|
||||
}
|
||||
if (bMasked && !ispatch) FindHoles(buffer, w, h);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -801,7 +738,6 @@ unsigned char * FTexture::CreateTexBuffer(int translation, int & w, int & h, int
|
|||
int W, H;
|
||||
int isTransparent = -1;
|
||||
|
||||
|
||||
if (flags & CTF_CheckHires)
|
||||
{
|
||||
buffer = LoadHiresTexture(&w, &h);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue