- DrawComponent: fixed normalizing to screen

This commit is contained in:
2024-01-31 16:55:41 +01:00
parent 587c3dfcbf
commit 861e03decf
+7 -3
View File
@@ -231,19 +231,23 @@ void DrawComponent::DrawData ()
return;
}
double max = arma::abs(m_data).max();
arma::mat data = m_data;
data = m_data - m_data.min();
double max = arma::abs(data).max();
if (max < 1.0)
{
max = 1.0;
}
double scale = m_scale/max;
data = data*scale;
for (int i=0; i < m_height; i++)
{
for (int j=0; j < m_width; j++)
{
m_pG->setColour(Colour(Colours::white).greyLevel(m_offset + scale*m_data(i*m_width + j)));
m_pG->setColour(Colour(Colours::white).greyLevel(m_offset + data(i*m_width + j)));
m_pG->fillRect(m_scaleX*j, m_scaleY*i, m_scaleX, m_scaleY);
}
}