mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-28 01:04:41 +08:00
(EasyGraphicsScrollbar) Tweaking colors coefficients
This commit is contained in:
parent
c0e2e345ec
commit
776039f543
@ -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));
|
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)
|
if (EASY_GLOBALS.frame_time <= m_minDuration)
|
||||||
frameCoeff = 0;
|
frameCoeff = 0;
|
||||||
else
|
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;
|
auto& items = *m_pSource;
|
||||||
for (const auto& item : items)
|
for (const auto& item : items)
|
||||||
{
|
{
|
||||||
// Draw rectangle
|
// Draw rectangle
|
||||||
|
|
||||||
const auto h = ::std::max((item.width() - m_minDuration) * coeff, 5.0);
|
const auto h = ::std::max((item.width() - m_minDuration) * coeff, 2.0);
|
||||||
const auto col = ::std::min(h * heightRevert * frameCoeff, 0.9999999);
|
const auto col = ::std::min(sqr(sqr(h)) * k, 0.9999999);
|
||||||
//const auto color = ::profiler_gui::toRgb(col * 255, (1.0 - col) * 255, 0); // item.color;
|
|
||||||
const auto color = 0x00ffffff & QColor::fromHsvF((1.0 - col) * 0.375, 0.85, 0.85).rgb();
|
const auto color = 0x00ffffff & QColor::fromHsvF((1.0 - col) * 0.375, 0.85, 0.85).rgb();
|
||||||
|
|
||||||
if (previousColor != color)
|
if (previousColor != color)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user