2014-01-19, 01:42
@lmyllari, use ceil on the result and compare with the correct division, if it's smaller epsilon -> use the ceil.
If difference between ceil and direct value < 0.01 use the ceil. E.g. 0.998f will be 1.0f
Code:
From 3eb236cd04dc43e0b5d3b26f421eb13eea2c6116 Mon Sep 17 00:00:00 2001
From: fritsch <[email protected]>
Date: Sun, 19 Jan 2014 00:56:07 +0100
Subject: [PATCH] WinSystemX11: Don't try to scale scale values near to 1.0f
---
xbmc/windowing/X11/WinSystemX11.cpp | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/xbmc/windowing/X11/WinSystemX11.cpp b/xbmc/windowing/X11/WinSystemX11.cpp
index 083d1e9..5a821fd 100644
--- a/xbmc/windowing/X11/WinSystemX11.cpp
+++ b/xbmc/windowing/X11/WinSystemX11.cpp
@@ -277,8 +277,13 @@ void CWinSystemX11::UpdateResolutions()
res.iHeight = mode.h;
res.iScreenWidth = mode.w;
res.iScreenHeight = mode.h;
- if (mode.h>0 && mode.w>0 && out.hmm>0 && out.wmm>0)
+ if (mode.h > 0 && mode.w > 0 && out.hmm > 0 && out.wmm > 0)
+ {
res.fPixelRatio = ((float)out.wmm/(float)mode.w) / (((float)out.hmm/(float)mode.h));
+ float ceilRatio = ceil(res.fPixelRatio);
+ if (fabs(ceilRatio - res.fPixelRatio) < 0.01)
+ res.fPixelRatio = ceilRatio;
+ }
else
res.fPixelRatio = 1.0f;
--
1.8.3.2
If difference between ceil and direct value < 0.01 use the ceil. E.g. 0.998f will be 1.0f