@@ -522,6 +522,8 @@ void LfpDisplay::refresh()
522522 // std::cout << fillfrom << " : " << fillto << " ::: " << "totalPixelsToFill: " << totalPixelsToFill << std::endl;
523523
524524 int fillfrom_local, fillto_local;
525+ int channelFillFrom = fillfrom;
526+ int channelFillTo = fillto;
525527
526528 if (canvasSplit->fullredraw )
527529 {
@@ -561,8 +563,17 @@ void LfpDisplay::refresh()
561563 }
562564 else
563565 {
564- fillfrom_local = lastBitmapIndex;
565- fillto_local = (lastBitmapIndex + totalPixelsToFill) % totalXPixels;
566+ if (totalPixelsToFill >= totalXPixels)
567+ {
568+ channelFillFrom = (fillto - totalXPixels + canvasSplit->screenBufferWidth ) % canvasSplit->screenBufferWidth ;
569+ fillfrom_local = 0 ;
570+ fillto_local = totalXPixels;
571+ }
572+ else
573+ {
574+ fillfrom_local = lastBitmapIndex;
575+ fillto_local = (lastBitmapIndex + totalPixelsToFill) % totalXPixels;
576+ }
566577
567578 // if (fillto != 0)
568579 // {
@@ -572,8 +583,8 @@ void LfpDisplay::refresh()
572583
573584 for (int i = 0 ; i < numChans; i++)
574585 {
575- channels[i]->ifrom = fillfrom ; // canvasSplit->lastScreenBufferIndex[0];
576- channels[i]->ito = fillto ; // canvasSplit->screenBufferIndex[0];
586+ channels[i]->ifrom = channelFillFrom ; // canvasSplit->lastScreenBufferIndex[0];
587+ channels[i]->ito = channelFillTo ; // canvasSplit->screenBufferIndex[0];
577588 channels[i]->ifrom_local = fillfrom_local;
578589 channels[i]->ito_local = fillto_local;
579590 }
0 commit comments