gfxtest: Adjust cursor velocity to framebuffer scaling
When showing a small, highly scaled picture, the cursor often
appeared erratic. It became more visible since we allow smal-
ler framebuffer clippings. So we'll reset the cursor velocity
for every clipping now, to match the framebuffer scaling.
Change-Id: I74b243919522c4910d1295bbc3119627b7d583db
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.sourcearcade.org/c/libgfxinit/+/552
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Thomas Heijligen <src@posteo.de>
Tested-by: Nico Huber <nico.h@gmx.de>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
diff --git a/gfxtest/hw-gfx-gma-gfx_test.adb b/gfxtest/hw-gfx-gma-gfx_test.adb
index 3ae9635..d4bd145 100644
--- a/gfxtest/hw-gfx-gma-gfx_test.adb
+++ b/gfxtest/hw-gfx-gma-gfx_test.adb
@@ -593,9 +593,7 @@
Cursor_Infos :=
(others =>
(Color => Pipe_Index'Val (Rand (Gen) mod 3),
- Size => Cursor_64x64,
- X_Velo => 3 * Cursor_Rand (Gen),
- Y_Velo => 3 * Cursor_Rand (Gen),
+ Size => Cursor_Size'Val (Rand (Gen) mod 3),
others => Cursor_Rand (Gen)));
Script_Cursors (Pipes, Hotplug_List, Deadline, Primary_Delay_MS);
@@ -620,6 +618,7 @@
New_FB : Framebuffer_Type renames
New_Pipes (Pipe).Framebuffer;
Cursor : Cursor_Type renames New_Pipes (Pipe).Cursor;
+ CI : Cursor_Info renames Cursor_Infos (Pipe);
Width : constant Width_Type :=
Pipes (Pipe).Framebuffer.Width;
Height : constant Height_Type :=
@@ -637,6 +636,8 @@
Cursor.Mode := No_Cursor;
Cursor.Center_X := Rotated_Width (New_FB) / 2;
Cursor.Center_Y := Rotated_Height (New_FB) / 2;
+ CI.X_Velo := 6 * Cursor_Rand (Gen) / (Width / New_FB.Width);
+ CI.Y_Velo := 6 * Cursor_Rand (Gen) / (Height / New_FB.Height);
end;
end loop;
GMA.Dump_Configs (New_Pipes);