summaryrefslogtreecommitdiffstats
path: root/platform/linuxbsd/x11/display_server_x11.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-06-07 23:29:57 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-06-07 23:29:57 +0200
commite52658643d07467db269ee86e086abfcf05d525e (patch)
treecb861de8c7887cfbeae1c6955d1305550a0d0168 /platform/linuxbsd/x11/display_server_x11.cpp
parent33b201fc85fb6e6ff1ba8931768bab99109ce0a7 (diff)
parent91e995e704a6b43ecea37ab0fafebe4165e51ed6 (diff)
downloadredot-engine-e52658643d07467db269ee86e086abfcf05d525e.tar.gz
Merge pull request #92702 from kleonc/cursor_image_from_atlas_texture_fix
Fix creating cursor image from `AtlasTexture`
Diffstat (limited to 'platform/linuxbsd/x11/display_server_x11.cpp')
-rw-r--r--platform/linuxbsd/x11/display_server_x11.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/platform/linuxbsd/x11/display_server_x11.cpp b/platform/linuxbsd/x11/display_server_x11.cpp
index 34b6d0219a..4ca1b11094 100644
--- a/platform/linuxbsd/x11/display_server_x11.cpp
+++ b/platform/linuxbsd/x11/display_server_x11.cpp
@@ -3108,8 +3108,7 @@ void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu
cursors_cache.erase(p_shape);
}
- Rect2 atlas_rect;
- Ref<Image> image = _get_cursor_image_from_resource(p_cursor, p_hotspot, atlas_rect);
+ Ref<Image> image = _get_cursor_image_from_resource(p_cursor, p_hotspot);
ERR_FAIL_COND(image.is_null());
Vector2i texture_size = image->get_size();
@@ -3127,13 +3126,8 @@ void DisplayServerX11::cursor_set_custom_image(const Ref<Resource> &p_cursor, Cu
cursor_image->pixels = (XcursorPixel *)memalloc(size);
for (XcursorPixel index = 0; index < image_size; index++) {
- int row_index = floor(index / texture_size.width) + atlas_rect.position.y;
- int column_index = (index % int(texture_size.width)) + atlas_rect.position.x;
-
- if (atlas_rect.has_area()) {
- column_index = MIN(column_index, atlas_rect.size.width - 1);
- row_index = MIN(row_index, atlas_rect.size.height - 1);
- }
+ int row_index = floor(index / texture_size.width);
+ int column_index = index % int(texture_size.width);
*(cursor_image->pixels + index) = image->get_pixel(column_index, row_index).to_argb32();
}