docs: private ContributorList calcXContrib(double xscale, double fwidth, int srcwidth, InterpolationFilter pFilter, int i) {
          // TODO: What to do when fwidth > srcwidyj or dstwidth
  
          double width;
          double fscale;
          double center;
          double weight;
  
          ContributorList contribX = new ContributorList();
  
          if (xscale < 1.0) {
              /* Shrinking image */
              width = fwidth / xscale;
              fscale = 1.0 / xscale;
  
              if (width <= .5) {
                  // Reduce to point sampling.
                  width = .5 + 1.0e-6;
                  fscale = 1.0;
              }
  
              //contribX.n = 0;
              contribX.p = new Contributor[(int) (width * 2.0 + 1.0 + 0.5)];
  
              center = (double) i / xscale;
              int left = (int) Math.ceil(center - width);// Note: Assumes width <= .5
              int right = (int) Math.floor(center + width);
  
              double density = 0.0;
  
              for (int j = left; j <= right; j++) {
                  weight = center - (double) j;
                  weight = pFilter.filter(weight / fscale) / fscale;
                  int n;
                  if (j < 0) {
                      n = -j;
                  }
                  else if (j >= srcwidth) {
                      n = (srcwidth - j) + srcwidth - 1;
                  }
                  else {
                      n = j;
                  }
  
                  /**/
                  if (n >= srcwidth) {
                      n = n % srcwidth;
                  }
                  else if (n < 0) {
                      n = srcwidth - 1;
                  }
                  /**/
  
                  int k = contribX.n++;
                  contribX.p[k] = new Contributor();
                  contribX.p[k].pixel = n;
                  contribX.p[k].weight = weight;
  
                  density += weight;
  
              }
  
              if ((density != 0.0) && (density != 1.0)) {
                  //Normalize.
                  density = 1.0 / density;
                  for (int k = 0; k < contribX.n; k++) {
                      contribX.p[k].weight *= density;
                  }
              }
          }
          else {
              /* Expanding image */
              //contribX.n = 0;
              contribX.p = new Contributor[(int) (fwidth * 2.0 + 1.0 + 0.5)];
  
              center = (double) i / xscale;
              int left = (int) Math.ceil(center - fwidth);
              int right = (int) Math.floor(center + fwidth);
  
              for (int j = left; j <= right; j++) {
                  weight = center - (double) j;
                  weight = pFilter.filter(weight);
  
                  int n;
                  if (j < 0) {
                      n = -j;
                  }
                  else if (j >= srcwidth) {
                      n = (srcwidth - j) + srcwidth - 1;
                  }
                  else {
                      n = j;
                  }
  
                  /**/
                  if (n >= srcwidth) {
                      n = n % srcwidth;
                  }
                  else if (n < 0) {
                      n = srcwidth - 1;
                  }
                  /**/
  
                  int k = contribX.n++;
                  contribX.p[k] = new Contributor();
                  contribX.p[k].pixel = n;
                  contribX.p[k].weight = weight;
              }
          }
          return contribX;
      }