node_modules/echarts/lib/chart/line/LineView.js
/**
 * Clip color stops to edge. Avoid creating too large gradients.
 * Which may lead to blurry when GPU acceleration is enabled. See #15680
 *
 * The stops has been sorted from small to large.
 */
Clip color stops to edge. Avoid creating too large gradients.
Which may lead to blurry when GPU acceleration is enabled.

The stops has been sorted from small to large.
Clip color stops to edge . Avoid creating too large gradients . Which may lead to blurry when GPU acceleration is enabled . The stops has been sorted from small to large .
function clipColorStops(colorStops, maxSize) {
  var newColorStops = [];
  var len = colorStops.length; 
  var prevOutOfRangeColorStop;
  var prevInRangeColorStop;
  function lerpStop(stop0, stop1, clippedCoord) {
    var coord0 = stop0.coord;
    var p = (clippedCoord - coord0) / (stop1.coord - coord0);
    var color = lerp(p, [stop0.color, stop1.color]);
    return {
      coord: clippedCoord,
      color: color
    };
  }
  for (var i = 0; i < len; i++) {
    var stop_1 = colorStops[i];
    var coord = stop_1.coord;
    if (coord < 0) {
      prevOutOfRangeColorStop = stop_1;
    } else if (coord > maxSize) {
      if (prevInRangeColorStop) {
        newColorStops.push(lerpStop(prevInRangeColorStop, stop_1, maxSize));
      } else if (prevOutOfRangeColorStop) {
        newColorStops.push(lerpStop(prevOutOfRangeColorStop, stop_1, 0), lerpStop(prevOutOfRangeColorStop, stop_1, maxSize));
      } 
      break;
    } else {
      if (prevOutOfRangeColorStop) {
        newColorStops.push(lerpStop(prevOutOfRangeColorStop, stop_1, 0)); 
        prevOutOfRangeColorStop = null;
      }
      newColorStops.push(stop_1);
      prevInRangeColorStop = stop_1;
    }
  }
  return newColorStops;
}
function clipColorStops ( colorStops , maxSize ) { var newColorStops = [ ] ; var len = colorStops . length ; var prevOutOfRangeColorStop ; var prevInRangeColorStop ; function lerpStop ( stop0 , stop1 , clippedCoord ) { var coord0 = stop0 . coord ; var p = ( clippedCoord - coord0 ) / ( stop1 . coord - coord0 ) ; var color = lerp ( p , [ stop0 . color , stop1 . color ] ) ; return { coord : clippedCoord , color : color } ; } for ( var i = 0 ; i < len ; i ++ ) { var stop_1 = colorStops [ i ] ; var coord = stop_1 . coord ; if ( coord < 0 ) { prevOutOfRangeColorStop = stop_1 ; } else if ( coord > maxSize ) { if ( prevInRangeColorStop ) { newColorStops . push ( lerpStop ( prevInRangeColorStop , stop_1 , maxSize ) ) ; } else if ( prevOutOfRangeColorStop ) { newColorStops . push ( lerpStop ( prevOutOfRangeColorStop , stop_1 , 0 ) , lerpStop ( prevOutOfRangeColorStop , stop_1 , maxSize ) ) ; } break ; } else { if ( prevOutOfRangeColorStop ) { newColorStops . push ( lerpStop ( prevOutOfRangeColorStop , stop_1 , 0 ) ) ; prevOutOfRangeColorStop = null ; } newColorStops . push ( stop_1 ) ; prevInRangeColorStop = stop_1 ; } } return newColorStops ; }
Clip color stops to edge.
Clip color stops to edge .
// coord will always < 0 in prevOutOfRangeColorStop. // If there are two stops and coord range is between these two stops // All following stop will be out of range. So just ignore them. // Reset