From 5be4eb9fc607bf5fb259fc58254938225bb523c4 Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Sat, 16 Mar 2024 15:02:28 +0100 Subject: [PATCH] Simplify Control internal transform calculation --- scene/gui/control.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scene/gui/control.cpp b/scene/gui/control.cpp index 2d425490d1f..5c6f9eca1e4 100644 --- a/scene/gui/control.cpp +++ b/scene/gui/control.cpp @@ -682,12 +682,10 @@ Size2 Control::get_parent_area_size() const { // Positioning and sizing. Transform2D Control::_get_internal_transform() const { - Transform2D rot_scale; - rot_scale.set_rotation_and_scale(data.rotation, data.scale); - Transform2D offset; - offset.set_origin(-data.pivot_offset); - - return offset.affine_inverse() * (rot_scale * offset); + // T(pivot_offset) * R(rotation) * S(scale) * T(-pivot_offset) + Transform2D xform(data.rotation, data.scale, 0.0f, data.pivot_offset); + xform.translate_local(-data.pivot_offset); + return xform; } void Control::_update_canvas_item_transform() {