From f0409be76564171a97a792deabab3bd0528fe40c Mon Sep 17 00:00:00 2001 From: Virt <41426325+VirtCode@users.noreply.github.com> Date: Thu, 18 Jul 2024 08:49:59 +0200 Subject: [PATCH] fix: clamp padding to integer value --- src/cursor.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cursor.cpp b/src/cursor.cpp index 5abacc9..06e3d09 100644 --- a/src/cursor.cpp +++ b/src/cursor.cpp @@ -112,7 +112,7 @@ void CDynamicCursors::damageSoftware(CPointerManager* pointers) { // we damage a padding of the diagonal around the hotspot, to accomodate for all possible hotspots and rotations auto zoom = resultShown.scale; Vector2D size = pointers->currentCursorImage.size / pointers->currentCursorImage.scale * zoom; - float diagonal = size.size(); + int diagonal = size.size(); Vector2D padding = {diagonal, diagonal}; CBox b = CBox{pointers->pointerPos, size + (padding * 2)}.translate(-(pointers->currentCursorImage.hotspot * zoom + padding)); @@ -142,7 +142,7 @@ wlr_buffer* CDynamicCursors::renderHardware(CPointerManager* pointers, SPcurrentCursorImage.size * zoom; - float diagonal = size.size(); + int diagonal = size.size(); Vector2D padding = {diagonal, diagonal}; // we try to allocate a buffer with padding, see software damage @@ -232,7 +232,7 @@ bool CDynamicCursors::setHardware(CPointerManager* pointers, SPoutput->cursor_swapchain) return false; // we need to transform the hotspot manually as we need to indent it by the padding - float diagonal = pointers->currentCursorImage.size.size(); + int diagonal = pointers->currentCursorImage.size.size(); Vector2D padding = {diagonal, diagonal}; const auto HOTSPOT = CBox{((pointers->currentCursorImage.hotspot * P_MONITOR->scale) + padding) * resultShown.scale, {0, 0}}