From 60f5d0e34a12a3092e84b578ced3f1670a6713bc Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Tue, 4 Feb 2020 11:46:18 +0100 Subject: [PATCH] gems/animated_geometry.h: increase value range The value range supported by the 'Animated_rect' utility is constrained to 2^11 by the used 32-bit integer type. The interpolation is performed on fixpoint numbers with a fractional precision of 10 bits. The non-linear interpolation as performed by the 'Lazy_value' utility involves squaring the values. Hence, the interpolated integral values must not exceed 2^11 (2*11 bits for the square plus 10 bit for the fractional part require 32 bits). This range is too small for high-resolution displays. Hence this patch replaces the 32-bit integer type by a 64-bit integer type. Fixes #3627 --- repos/gems/include/gems/animated_geometry.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/repos/gems/include/gems/animated_geometry.h b/repos/gems/include/gems/animated_geometry.h index 1a3a20a1b..346ef9e00 100644 --- a/repos/gems/include/gems/animated_geometry.h +++ b/repos/gems/include/gems/animated_geometry.h @@ -36,11 +36,13 @@ class Genode::Animated_rect : private Animator::Item, Noncopyable Rect _rect { }; + using Lazy_value = ::Lazy_value; + struct Animated_point { bool _initial = true; - Lazy_value _x { }, _y { }; + Lazy_value _x { }, _y { }; void animate() { _x.animate(); _y.animate(); } @@ -49,8 +51,8 @@ class Genode::Animated_rect : private Animator::Item, Noncopyable void move_to(Point p, Steps steps) { if (_initial) { - _x = Lazy_value(p.x() << 10); - _y = Lazy_value(p.y() << 10); + _x = Lazy_value(p.x() << 10); + _y = Lazy_value(p.y() << 10); _initial = false; } else { _x.dst(p.x() << 10, steps.value);