diff --git a/src/core/label_fade_tracker.h b/src/core/label_fade_tracker.h index e9038fa..298f3e3 100644 --- a/src/core/label_fade_tracker.h +++ b/src/core/label_fade_tracker.h @@ -1,6 +1,7 @@ #pragma once #include +#include #include #include #include @@ -146,11 +147,25 @@ bool update_and_draw_faded_labels( bool primary = false; bool suppressed = false; }; + class Emitted_texts + { + public: + void push_back(emitted_text_t text) { m_values[m_count++] = text; } + auto begin() { return m_values.begin(); } + auto end() { return m_values.begin() + m_count; } + auto begin() const { return m_values.begin(); } + auto end() const { return m_values.begin() + m_count; } + + private: + // A label only emits its previous and current text during a crossfade. + std::array m_values{}; + std::size_t m_count = 0; + }; struct emitted_state_t { key_t key; const std::string* final_text = nullptr; - std::vector texts; + Emitted_texts texts; }; bool any_active = false; diff --git a/src/core/series_renderer.cpp b/src/core/series_renderer.cpp index 0ccfb18..4321d10 100644 --- a/src/core/series_renderer.cpp +++ b/src/core/series_renderer.cpp @@ -1524,7 +1524,7 @@ void Series_renderer::prepare( layer->z_order()}); } } - // Sort by z_order before preparing. The global stable_sort of + // Sort by z_order before preparing. The global sort of // prepared_draws below independently fixes the final record order, but // this per-view sort is still load-bearing: it determines the order in // which layers are *prepared*, which is a tested contract (a lower @@ -1786,7 +1786,8 @@ void Series_renderer::prepare( } } - std::stable_sort( + // The unique insertion_order breaks all ties, so stability adds no ordering guarantee. + std::sort( m_rhi_state->prepared_draws.begin(), m_rhi_state->prepared_draws.end(), [](const auto& a, const auto& b) {