Changeset - 0d495816e66c
[Not reviewed]
default
0 1 0
Hasan Yavuz Ă–ZDERYA - 8 years ago 2017-08-16 09:19:51
hy@ozderya.net
fix samples that are at the edges not shown or in very high zoom nothing is shown
1 file changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/framebufferseries.cpp
Show inline comments
 
@@ -17,6 +17,7 @@
 
  along with serialplot.  If not, see <http://www.gnu.org/licenses/>.
 
*/
 

	
 
#include <math.h>
 
#include "framebufferseries.h"
 

	
 
FrameBufferSeries::FrameBufferSeries(FrameBuffer* buffer)
 
@@ -73,15 +74,15 @@ void FrameBufferSeries::setRectOfInteres
 
{
 
    if (xAsIndex)
 
    {
 
        int_index_start = rect.left();
 
        int_index_end = rect.right();
 
        int_index_start = floor(rect.left())-1;
 
        int_index_end = ceil(rect.right())+1;
 
    }
 
    else
 
    {
 
        double xsize = _xmax - _xmin;
 
        size_t bsize = _buffer->size();
 
        int_index_start =  bsize * (rect.left()-_xmin) / xsize;
 
        int_index_end = bsize * (rect.right()-_xmin) / xsize;
 
        int_index_start =  floor(bsize * (rect.left()-_xmin) / xsize)-1;
 
        int_index_end = ceil(bsize * (rect.right()-_xmin) / xsize)+1;
 
    }
 

	
 
    int_index_start = std::max(int_index_start, (size_t) 0);
0 comments (0 inline, 0 general)