Changeset - ebfc27478fc5
[Not reviewed]
default
0 1 0
Hasan Yavuz Ă–ZDERYA - 9 years ago 2016-08-15 00:12:10
hy@ozderya.net
fix auto scale always including 0
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/framebuffer.cpp
Show inline comments
 
@@ -93,50 +93,50 @@ void FrameBuffer::addSamples(double* sam
 
        else // there isn't enough room
 
        {
 
            for (size_t i = 0; i < x; i++) // fill the end part
 
            {
 
                data[i+headIndex] = samples[i];
 
            }
 
            for (size_t i = 0; i < (shift-x); i++) // continue from the beginning
 
            {
 
                data[i] = samples[i+x];
 
            }
 
            headIndex = shift-x;
 
        }
 
    }
 
    else // number of new samples equal or bigger than current size
 
    {
 
        int x = shift - _size;
 
        for (size_t i = 0; i < _size; i++)
 
        {
 
            data[i] = samples[i+x];
 
        }
 
        headIndex = 0;
 
    }
 

	
 
    // update bounding rectangle
 
    double minValue = 0;
 
    double maxValue = 0;
 
    double minValue = data[0];
 
    double maxValue = data[0];
 
    for (size_t i = 0; i < _size; i++)
 
    {
 
        if (data[i] > maxValue)
 
        {
 
            maxValue = data[i];
 
        }
 
        else if (data[i] < minValue)
 
        {
 
            minValue = data[i];
 
        }
 
    }
 
    _boundingRect.setTop(minValue);
 
    _boundingRect.setBottom(maxValue);
 
}
 

	
 
void FrameBuffer::clear()
 
{
 
    for (size_t i=0; i < _size; i++) data[i] = 0.;
 
}
 

	
 
size_t FrameBuffer::size() const
 
{
 
    return _size;
 
}
0 comments (0 inline, 0 general)