mirror of
https://github.com/ZDoom/gzdoom.git
synced 2025-02-02 14:42:32 +00:00
- initialize texture offsets for images on construction.
This commit is contained in:
parent
61380fc505
commit
eb369dbf41
2 changed files with 25 additions and 9 deletions
|
@ -983,6 +983,30 @@ FWrapperTexture::FWrapperTexture(int w, int h, int bits)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
FGameTexture::FGameTexture(FTexture* wrap) : Base(wrap)
|
||||||
|
{
|
||||||
|
id.SetInvalid();
|
||||||
|
TexelWidth = Base->GetWidth();
|
||||||
|
DisplayWidth = (float)TexelWidth;
|
||||||
|
TexelHeight = Base->GetHeight();
|
||||||
|
DisplayHeight = (float)TexelHeight;
|
||||||
|
auto img = Base->GetImage();
|
||||||
|
if (img)
|
||||||
|
{
|
||||||
|
auto ofs = img->GetOffsets();
|
||||||
|
LeftOffset[0] = LeftOffset[1] = ofs.first;
|
||||||
|
TopOffset[0] = TopOffset[1] = ofs.second;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LeftOffset[0] = LeftOffset[1] =
|
||||||
|
TopOffset[0] = TopOffset[1] = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
ScaleX = ScaleY = 1.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
FGameTexture::~FGameTexture()
|
FGameTexture::~FGameTexture()
|
||||||
{
|
{
|
||||||
FGameTexture* link = fileSystem.GetLinkedTexture(GetSourceLump());
|
FGameTexture* link = fileSystem.GetLinkedTexture(GetSourceLump());
|
||||||
|
|
|
@ -569,15 +569,7 @@ class FGameTexture
|
||||||
FMaterial* Material[4] = { };
|
FMaterial* Material[4] = { };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FGameTexture(FTexture* wrap) : Base(wrap)
|
FGameTexture(FTexture* wrap);
|
||||||
{
|
|
||||||
id.SetInvalid();
|
|
||||||
TexelWidth = Base->GetWidth();
|
|
||||||
DisplayWidth = (float)TexelWidth;
|
|
||||||
TexelHeight = Base->GetHeight();
|
|
||||||
DisplayHeight = (float)TexelHeight;
|
|
||||||
ScaleX = ScaleY = 1.f;
|
|
||||||
}
|
|
||||||
~FGameTexture();
|
~FGameTexture();
|
||||||
FTextureID GetID() const { return id; }
|
FTextureID GetID() const { return id; }
|
||||||
void SetID(FTextureID newid) { id = newid; } // should only be called by the texture manager
|
void SetID(FTextureID newid) { id = newid; } // should only be called by the texture manager
|
||||||
|
|
Loading…
Reference in a new issue