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

(EasyGraphicsScrollbar) Tweaking colors coefficients

This commit is contained in:
Victor Zarubkin 2016-11-13 22:16:50 +03:00
parent c0e2e345ec
commit 776039f543

View File

@ -60,10 +60,15 @@ const int INDICATOR_SIZE = 8;
//////////////////////////////////////////////////////////////////////////
auto const clamp = [](qreal _minValue, qreal _value, qreal _maxValue)
inline qreal clamp(qreal _minValue, qreal _value, qreal _maxValue)
{
return (_value < _minValue ? _minValue : (_value > _maxValue ? _maxValue : _value));
};
}
inline qreal sqr(qreal _value)
{
return _value * _value;
}
//////////////////////////////////////////////////////////////////////////
@ -225,17 +230,18 @@ void EasyMinimapItem::paint(QPainter* _painter, const QStyleOptionGraphicsItem*
if (EASY_GLOBALS.frame_time <= m_minDuration)
frameCoeff = 0;
else
frameCoeff = (m_maxDuration - m_minDuration) / (EASY_GLOBALS.frame_time - m_minDuration);
frameCoeff = 0.9 * (m_maxDuration - m_minDuration) / (EASY_GLOBALS.frame_time - m_minDuration);
}
const auto k = sqr(sqr(heightRevert * frameCoeff));
auto& items = *m_pSource;
for (const auto& item : items)
{
// Draw rectangle
const auto h = ::std::max((item.width() - m_minDuration) * coeff, 5.0);
const auto col = ::std::min(h * heightRevert * frameCoeff, 0.9999999);
//const auto color = ::profiler_gui::toRgb(col * 255, (1.0 - col) * 255, 0); // item.color;
const auto h = ::std::max((item.width() - m_minDuration) * coeff, 2.0);
const auto col = ::std::min(sqr(sqr(h)) * k, 0.9999999);
const auto color = 0x00ffffff & QColor::fromHsvF((1.0 - col) * 0.375, 0.85, 0.85).rgb();
if (previousColor != color)