mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +00:00
Clamped the scale factor in NinePatchComponent to avoid artifacts for extreme screen resolutions.
This commit is contained in:
parent
0b259dc47a
commit
a3c2f831c8
|
@ -51,8 +51,11 @@ void NinePatchComponent::buildVertices()
|
||||||
if (mVertices != nullptr)
|
if (mVertices != nullptr)
|
||||||
delete[] mVertices;
|
delete[] mVertices;
|
||||||
|
|
||||||
// Scale the corner size relative to the screen resolution.
|
// Scale the corner size relative to the screen resolution, but keep the scale factor
|
||||||
mTexture = TextureResource::get(mPath, false, false, true, Renderer::getScreenWidthModifier());
|
// within reason as extreme resolutions may cause artifacts. Any "normal" resolution
|
||||||
|
// (e.g. from 720p to 4K) will be within these boundaries though.
|
||||||
|
float scaleFactor = Math::clamp(Renderer::getScreenWidthModifier(), 0.4f, 3.0f);
|
||||||
|
mTexture = TextureResource::get(mPath, false, false, true, scaleFactor);
|
||||||
|
|
||||||
if (mTexture->getSize() == Vector2i::Zero()) {
|
if (mTexture->getSize() == Vector2i::Zero()) {
|
||||||
mVertices = nullptr;
|
mVertices = nullptr;
|
||||||
|
|
Loading…
Reference in a new issue