Fixed an issue where rasterized window corners would look excessively pixelated.

This commit is contained in:
Leon Styhre 2021-10-30 13:07:07 +02:00
parent 5c54e52ecd
commit 190b3ba054

View file

@ -53,10 +53,18 @@ void NinePatchComponent::buildVertices()
if (mVertices != nullptr)
delete[] mVertices;
// Scale the corner size relative to the screen resolution.
glm::vec2 relCornerSize = glm::round(
mCornerSize *
((Renderer::getScreenHeightModifier() + Renderer::getScreenWidthModifier()) / 2.0f));
glm::vec2 relCornerSize{};
// Don't scale the rasterized version of the frame as it would look bad.
if (mPath.substr(mPath.size() - 4, std::string::npos) == ".png") {
relCornerSize = mCornerSize;
}
else {
// Scale the corner size relative to the screen resolution.
relCornerSize = glm::round(
mCornerSize *
((Renderer::getScreenHeightModifier() + Renderer::getScreenWidthModifier()) / 2.0f));
}
mTexture = TextureResource::get(mPath, false, false, false);
glm::vec2 texSize = relCornerSize * 3.0f;