Fixed a graphical glitch caused by inaccurate rounding.

This commit is contained in:
Leon Styhre 2021-01-19 21:50:14 +01:00
parent 96c742dee4
commit e4f440ca9a
5 changed files with 19 additions and 12 deletions

View file

@ -117,6 +117,7 @@ Many bugs have been fixed, and numerous features that were only partially implem
* Deleting a game from the metadata editor did not delete the game media files or its entry in the gamelist.xml file * Deleting a game from the metadata editor did not delete the game media files or its entry in the gamelist.xml file
* Hidden files still showed up if they had a gamelist.xml entry * Hidden files still showed up if they had a gamelist.xml entry
* Fixed multiple instances of misaligned GUI elements on high-resolution displays due to the use of fixed-pixel constants * Fixed multiple instances of misaligned GUI elements on high-resolution displays due to the use of fixed-pixel constants
* Fixed a rounding issue which caused one pixel wide lines to sometimes be shown along the upper and left screen edges
* The VRAM statistics overlay was somewhat broken and incorrectly displayed numbers in megabytes instead of mebibytes * The VRAM statistics overlay was somewhat broken and incorrectly displayed numbers in megabytes instead of mebibytes
* Long game names would sometimes not scroll in the gamelist view * Long game names would sometimes not scroll in the gamelist view
* Game media was not rendered when moving between gamelists using the slide transition style * Game media was not rendered when moving between gamelists using the slide transition style

View file

@ -315,9 +315,9 @@ Transform4x4f& Transform4x4f::round()
{ {
float* tm = reinterpret_cast<float*>(this); float* tm = reinterpret_cast<float*>(this);
tm[12] = static_cast<float>(static_cast<int>(tm[12] + 0.5f)); tm[12] = std::round(tm[12]);
tm[13] = static_cast<float>(static_cast<int>(tm[13] + 0.5f)); tm[13] = std::round(tm[13]);
tm[14] = static_cast<float>(static_cast<int>(tm[14] + 0.5f)); tm[14] = std::round(tm[14]);
return *this; return *this;
} }

View file

@ -8,10 +8,12 @@
#include "math/Vector2f.h" #include "math/Vector2f.h"
#include <cmath>
Vector2f& Vector2f::round() Vector2f& Vector2f::round()
{ {
mX = static_cast<float>(static_cast<int>(mX + 0.5f)); mX = std::round(mX);
mY = static_cast<float>(static_cast<int>(mY + 0.5f)); mY = std::round(mY);
return *this; return *this;
} }

View file

@ -8,11 +8,13 @@
#include "math/Vector3f.h" #include "math/Vector3f.h"
#include <cmath>
Vector3f& Vector3f::round() Vector3f& Vector3f::round()
{ {
mX = static_cast<float>(static_cast<int>(mX + 0.5f)); mX = std::round(mX);
mY = static_cast<float>(static_cast<int>(mY + 0.5f)); mY = std::round(mY);
mZ = static_cast<float>(static_cast<int>(mZ + 0.5f)); mZ = std::round(mZ);
return *this; return *this;
} }

View file

@ -8,12 +8,14 @@
#include "math/Vector4f.h" #include "math/Vector4f.h"
#include <cmath>
Vector4f& Vector4f::round() Vector4f& Vector4f::round()
{ {
mX = static_cast<float>(static_cast<int>(mX + 0.5f)); mX = std::round(mX);
mY = static_cast<float>(static_cast<int>(mY + 0.5f)); mY = std::round(mY);
mZ = static_cast<float>(static_cast<int>(mZ + 0.5f)); mZ = std::round(mZ);
mW = static_cast<float>(static_cast<int>(mW + 0.5f)); mW = std::round(mW);
return *this; return *this;
} }