diff --git a/nel/src/gui/css_background_renderer.cpp b/nel/src/gui/css_background_renderer.cpp index 4d7df021e..2c755ad80 100644 --- a/nel/src/gui/css_background_renderer.cpp +++ b/nel/src/gui/css_background_renderer.cpp @@ -438,7 +438,7 @@ namespace NLGUI if (bg.repeatX == CSS_VALUE_ROUND) { - sint numTiles = std::max(1, (sint)std::round((float)areaW / texW)); + sint numTiles = std::max(1, (sint)std::ceil(((float)areaW / texW) - 0.5f)); texW = areaW / numTiles; if (bg.height.isAuto() && bg.repeatY != CSS_VALUE_ROUND) { @@ -449,7 +449,7 @@ namespace NLGUI if (bg.repeatY == CSS_VALUE_ROUND) { - sint numTiles = std::max(1, (sint)std::round((float)areaH / texH)); + sint numTiles = std::max(1, (sint)std::ceil(((float)areaH / texH) - 0.5f)); texH = areaH / numTiles; if (bg.width.isAuto() && bg.repeatX != CSS_VALUE_ROUND) { diff --git a/nel/src/gui/css_length.cpp b/nel/src/gui/css_length.cpp index 79465c27d..b68b90f25 100644 --- a/nel/src/gui/css_length.cpp +++ b/nel/src/gui/css_length.cpp @@ -30,9 +30,10 @@ namespace NLGUI bool CSSLength::parseValue(const std::string &value, bool allowPercent, bool allowNegative) { - static const std::set knownUnits = { + static const std::string knownUnitsArr[] = { "%", "rem", "em", "px", "pt", "vw", "vh", "vi", "vb", "vmin", "vmax" }; + static const std::set knownUnits(knownUnitsArr, &knownUnitsArr[sizeof(knownUnitsArr) / sizeof(knownUnitsArr[0])]); std::string::size_type pos = 0; std::string::size_type len = value.size(); diff --git a/nel/src/gui/libwww.cpp b/nel/src/gui/libwww.cpp index 5d739863d..69d0ca992 100644 --- a/nel/src/gui/libwww.cpp +++ b/nel/src/gui/libwww.cpp @@ -208,9 +208,10 @@ namespace NLGUI // *************************************************************************** bool getCssLength (float &value, std::string &unit, const std::string &str, bool neg) { - static const std::set knownUnits = { + static const std::string knownUnitsArr[] = { "%", "rem", "em", "px", "pt", "vw", "vh", "vi", "vb", "vmin", "vmax" }; + static const std::set knownUnits(knownUnitsArr, &knownUnitsArr[sizeof(knownUnitsArr) / sizeof(knownUnitsArr[0])]); std::string::size_type pos = 0; std::string::size_type len = str.size();