From b3045c1b68f4feb8c66db16134ca494a85d0e815 Mon Sep 17 00:00:00 2001 From: Victor Zarubkin Date: Tue, 27 Dec 2016 20:53:16 +0300 Subject: [PATCH] (GUI) Hystogram painting improvement --- profiler_gui/easy_graphics_scrollbar.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/profiler_gui/easy_graphics_scrollbar.cpp b/profiler_gui/easy_graphics_scrollbar.cpp index 2e28e60..c0ae35d 100644 --- a/profiler_gui/easy_graphics_scrollbar.cpp +++ b/profiler_gui/easy_graphics_scrollbar.cpp @@ -520,10 +520,15 @@ void EasyHystogramItem::paintById(QPainter* _painter) } else { - first = items.begin() + items.size() - 1; + first = items.begin() + (items.size() - 1); } - const auto n = static_cast(::std::distance(first, items.end())); + auto last = ::std::upper_bound(first, items.end(), maximum + EASY_GLOBALS.begin_time, [](qreal _value, ::profiler::block_index_t _item) + { + return _value < easyBlock(_item).tree.node->begin(); + }); + + const auto n = static_cast(::std::distance(first, last)); if (n > 0) {