From 763e9e0f35db08a962163dd1324e62161fa4dff8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Apr 2020 13:48:51 +0200 Subject: [PATCH] - fixed texture scaling setup in a few places. --- src/common/textures/gametexture.h | 5 +++-- src/common/textures/hires/hqresize.cpp | 2 +- src/common/textures/multipatchtexturebuilder.cpp | 1 - src/common/textures/texturemanager.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/common/textures/gametexture.h b/src/common/textures/gametexture.h index e34ce09491..3b2b690293 100644 --- a/src/common/textures/gametexture.h +++ b/src/common/textures/gametexture.h @@ -206,6 +206,7 @@ public: void CopySize(FGameTexture* BaseTexture) { Base->CopySize(BaseTexture->Base.get()); + SetDisplaySize(BaseTexture->GetDisplayWidth(), BaseTexture->GetDisplayHeight()); } // Glowing is a pure material property that should not filter down to the actual texture objects. @@ -248,8 +249,8 @@ public: { ScaleX = x; ScaleY = y; - DisplayWidth = x * TexelWidth; - DisplayHeight = y * TexelHeight; + DisplayWidth = TexelWidth / x; + DisplayHeight = TexelHeight / y; } const SpritePositioningInfo& GetSpritePositioning(int which) { if (spi == nullptr) SetupSpriteData(); return spi[which]; } diff --git a/src/common/textures/hires/hqresize.cpp b/src/common/textures/hires/hqresize.cpp index 2e7b2fb068..fe5beda4e3 100644 --- a/src/common/textures/hires/hqresize.cpp +++ b/src/common/textures/hires/hqresize.cpp @@ -514,7 +514,7 @@ int calcShouldUpscale(FGameTexture *tex) return 0; // already scaled? - if (tex->GetDisplayWidth() >= 2* tex->GetTexelWidth() || tex->GetDisplayHeight() >= 2*tex->GetTexelHeight()) + if (tex->GetScaleX() >= 2.f || tex->GetScaleY() > 2.f) return 0; return CTF_Upscale; diff --git a/src/common/textures/multipatchtexturebuilder.cpp b/src/common/textures/multipatchtexturebuilder.cpp index d95c681dcd..1ee3634930 100644 --- a/src/common/textures/multipatchtexturebuilder.cpp +++ b/src/common/textures/multipatchtexturebuilder.cpp @@ -901,7 +901,6 @@ void FMultipatchTextureBuilder::ResolveAllPatches() !buildinfo.bComplex) { AddImageToTexture(buildinfo.Parts[0].TexImage, buildinfo); - buildinfo.texture->Setup(buildinfo.Parts[0].TexImage); done = true; } } diff --git a/src/common/textures/texturemanager.cpp b/src/common/textures/texturemanager.cpp index c7cffd07cd..80458a6ab8 100644 --- a/src/common/textures/texturemanager.cpp +++ b/src/common/textures/texturemanager.cpp @@ -625,8 +625,8 @@ void FTextureManager::AddHiresTextures (int wadnum) auto gtex = MakeGameTexture(newtex, nullptr, ETextureType::Override); gtex->SetWorldPanning(true); gtex->SetDisplaySize(oldtex->GetDisplayWidth(), oldtex->GetDisplayHeight()); - gtex->SetOffsets(0, xs_RoundToInt(oldtex->GetDisplayLeftOffset(0) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(0) * gtex->GetScaleY())); - gtex->SetOffsets(1, xs_RoundToInt(oldtex->GetDisplayLeftOffset(1) * gtex->GetScaleX()), xs_RoundToInt(oldtex->GetDisplayTopOffset(1) * gtex->GetScaleY())); + gtex->SetOffsets(0, oldtex->GetTexelLeftOffset(0), oldtex->GetTexelTopOffset(0)); + gtex->SetOffsets(1, oldtex->GetTexelLeftOffset(1), oldtex->GetTexelTopOffset(1)); ReplaceTexture(tlist[i], gtex, true); } }