From 8b8807e37d2530324116943896c72d381d65cc15 Mon Sep 17 00:00:00 2001 From: lonesurvivor Date: Tue, 3 Jan 2017 10:27:24 +0100 Subject: [PATCH] Improvement to y_sort: make clear which item has to be drawn first when both have the same y coordinate (prevents possible flickering). Reapplying #7241 to the 3.0 code. --- servers/visual/visual_server_canvas.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/servers/visual/visual_server_canvas.h b/servers/visual/visual_server_canvas.h index b5412ed6080..e1edc47f9fa 100644 --- a/servers/visual/visual_server_canvas.h +++ b/servers/visual/visual_server_canvas.h @@ -44,7 +44,10 @@ public: _FORCE_INLINE_ bool operator()(const Item* p_left,const Item* p_right) const { - return p_left->xform.elements[2].y < p_right->xform.elements[2].y; + if(Math::abs(p_left->xform.elements[2].y - p_right->xform.elements[2].y) < CMP_EPSILON ) + return p_left->xform.elements[2].x < p_right->xform.elements[2].x; + else + return p_left->xform.elements[2].y < p_right->xform.elements[2].y; } };