diff options
author | John Pennycook <john.pennycook@gmail.com> | 2020-09-27 10:58:54 -0700 |
---|---|---|
committer | John Pennycook <john.pennycook@gmail.com> | 2020-09-27 10:58:54 -0700 |
commit | 8d3afa985b479417b46811050e9b8bd9f7861f06 (patch) | |
tree | 7e959093569ad0846f61a155608dbf2f00d281fc /servers/rendering/rendering_server_canvas.h | |
parent | 93d42693a3e08ca2686088291f3b580beb043fa5 (diff) |
Make YSort stable
Keeps track of the order in which items are collected by
_collect_ysort_children, and uses that order to break
ties between items with similar Y positions.
Diffstat (limited to 'servers/rendering/rendering_server_canvas.h')
-rw-r--r-- | servers/rendering/rendering_server_canvas.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/servers/rendering/rendering_server_canvas.h b/servers/rendering/rendering_server_canvas.h index 59c0d1fa52..cebe32fba0 100644 --- a/servers/rendering/rendering_server_canvas.h +++ b/servers/rendering/rendering_server_canvas.h @@ -51,6 +51,7 @@ public: Color ysort_modulate; Transform2D ysort_xform; Vector2 ysort_pos; + int ysort_index; RS::CanvasItemTextureFilter texture_filter; RS::CanvasItemTextureRepeat texture_repeat; @@ -69,6 +70,7 @@ public: ysort_children_count = -1; ysort_xform = Transform2D(); ysort_pos = Vector2(); + ysort_index = 0; texture_filter = RS::CANVAS_ITEM_TEXTURE_FILTER_DEFAULT; texture_repeat = RS::CANVAS_ITEM_TEXTURE_REPEAT_DEFAULT; } @@ -83,7 +85,7 @@ public: struct ItemPtrSort { _FORCE_INLINE_ bool operator()(const Item *p_left, const Item *p_right) const { if (Math::is_equal_approx(p_left->ysort_pos.y, p_right->ysort_pos.y)) { - return p_left->ysort_pos.x < p_right->ysort_pos.x; + return p_left->ysort_index < p_right->ysort_index; } return p_left->ysort_pos.y < p_right->ysort_pos.y; |