-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Description
Using DPIUtil.scaleDown is used and the value is then scaled up with DPIUtil.scaleUp again, the result could be different than the original values. We need to investigate how to improve that
Reproduction
For instance take a value int size = 12 at 125% (in pixels)
In points, we say DPIUtil.scaleDown(12, 125) = 10;
Then back to pixels using DPIUtil.scaleUp(10, 125) = 13
Hence, on scaling down certain values and scaling back up again, for those zooms which are not factor or multiple of 100, we do not get the same value due to the underlying floating point rounding in the scaleUp and scaleDown method, which leads to errorful results.
Since, we strictly use integer, we can prove esily that in number theory,
a function like f(x)=round(a×x) where a= z/100 rational, is invertible on Z iff a is an integer or reciprocal of an integer (meaning the multiplication factor is exact over integers), otherwise rounding errors break invertibility. Hence, the DPIUtil worked fantastically with full scaling in the past as there were no remainders in the scalingFactor calulation.
Expected Behavior
on DPIUtil.scaleUp, we should get 12 back as the result.
Necessary configuration:
--
Additional knowledge
--
Follow-up work
Metadata
Metadata
Assignees
Labels
Type
Projects
Status