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
This commit is contained in:
parent
46c5a90ba1
commit
60f5d0e34a
|
@ -36,11 +36,13 @@ class Genode::Animated_rect : private Animator::Item, Noncopyable
|
||||||
|
|
||||||
Rect _rect { };
|
Rect _rect { };
|
||||||
|
|
||||||
|
using Lazy_value = ::Lazy_value<int64_t>;
|
||||||
|
|
||||||
struct Animated_point
|
struct Animated_point
|
||||||
{
|
{
|
||||||
bool _initial = true;
|
bool _initial = true;
|
||||||
|
|
||||||
Lazy_value<int> _x { }, _y { };
|
Lazy_value _x { }, _y { };
|
||||||
|
|
||||||
void animate() { _x.animate(); _y.animate(); }
|
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)
|
void move_to(Point p, Steps steps)
|
||||||
{
|
{
|
||||||
if (_initial) {
|
if (_initial) {
|
||||||
_x = Lazy_value<int>(p.x() << 10);
|
_x = Lazy_value(p.x() << 10);
|
||||||
_y = Lazy_value<int>(p.y() << 10);
|
_y = Lazy_value(p.y() << 10);
|
||||||
_initial = false;
|
_initial = false;
|
||||||
} else {
|
} else {
|
||||||
_x.dst(p.x() << 10, steps.value);
|
_x.dst(p.x() << 10, steps.value);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user