mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-29 17:45:38 +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)
|
||||
delete[] mVertices;
|
||||
|
||||
// Scale the corner size relative to the screen resolution.
|
||||
mTexture = TextureResource::get(mPath, false, false, true, Renderer::getScreenWidthModifier());
|
||||
// Scale the corner size relative to the screen resolution, but keep the scale factor
|
||||
// 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()) {
|
||||
mVertices = nullptr;
|
||||
|
|
Loading…
Reference in a new issue