0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

(EasyGraphicsView) Painting context switches with outlined rectangles

This commit is contained in:
Victor Zarubkin 2016-09-06 00:23:46 +03:00
parent 33946770bb
commit d8d9a2fd32

View File

@ -514,12 +514,12 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
#ifdef EASY_STORE_CSWITCH_SEPARATELY
if (!m_pRoot->sync.empty())
{
_painter->setBrush(Qt::NoBrush);
QPen pen(QColor::fromRgba(0xe0f08040));
pen.setWidth(3);
_painter->setPen(pen);
_painter->setBrush(QColor::fromRgba(0xfff08040));
_painter->setPen(QColor::fromRgb(0x00505050));
qreal prevRight = -1e100, top = y() - 1;
qreal prevRight = -1e100, top = y() - 4, h = 3;
if (top + h < visibleBottom)
{
for (auto it = firstSync, end = m_pRoot->sync.end(); it != end; ++it)
{
const auto& item = easyBlock(*it).tree;
@ -536,17 +536,26 @@ void EasyGraphicsItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
begin *= currentScale;
begin -= dx;
width *= currentScale;
// r = begin + width;
// if (r <= prevRight) // This item is not visible
// continue;
r = begin + width;
if (r <= prevRight) // This item is not visible
continue;
if (width < 1)
width = 1;
if (begin < prevRight)
{
width -= prevRight - begin;
begin = prevRight;
}
_painter->drawLine(QLineF(begin, top, begin + width, top));
if (width < 2)
width = 2;
//_painter->drawLine(QLineF(::std::max(begin, prevRight), top, begin + width, top));
rect.setRect(begin, top, width, h);
_painter->drawRect(rect);
prevRight = begin + width;
}
}
}
#endif