- DrawComponent: fixed normalizing to screen
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user