Program: 75851
Project: 75851
Buggy source:
public void fillPolygon(PolygonRenderEvent pre) throws ChartException {
  final Fill flBackground=validateMultipleFill(pre.getBackground());
  if (isFullTransparent(flBackground)) {
    return;
  }
  final Location[] loa=pre.getPoints();
  final int[][] i2a=getCoordinatesAsInts(loa);
  if (flBackground instanceof ColorDefinition) {
    final ColorDefinition cd=(ColorDefinition)flBackground;
    _g2d.setColor((Color)_ids.getColor(cd));
    _g2d.fill(new Polygon(i2a[0],i2a[1],loa.length));
  }
 else   if (flBackground instanceof Gradient) {
    final Gradient g=(Gradient)flBackground;
    final ColorDefinition cdStart=g.getStartColor();
    final ColorDefinition cdEnd=g.getEndColor();
    final double dAngleInDegrees=g.getDirection();
    final double dAngleInRadians=((-dAngleInDegrees * Math.PI) / 180.0);
    final double dMinX=BaseRenderer.getX(loa,IConstants.MIN);
    final double dMaxX=BaseRenderer.getX(loa,IConstants.MAX);
    final double dMinY=BaseRenderer.getY(loa,IConstants.MIN);
    final double dMaxY=BaseRenderer.getY(loa,IConstants.MAX);
    if (dAngleInDegrees < -90 || dAngleInDegrees > 90) {
      throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{new Double(dAngleInDegrees)},Messages.getResourceBundle(getULocale()));
    }
    Point2D.Double p2dStart, p2dEnd;
    if (dAngleInDegrees == 90) {
      p2dStart=new Point2D.Double(dMinX,dMaxY);
      p2dEnd=new Point2D.Double(dMinX,dMinY);
    }
 else     if (dAngleInDegrees == -90) {
      p2dStart=new Point2D.Double(dMinX,dMinY);
      p2dEnd=new Point2D.Double(dMinX,dMaxY);
    }
 else     if (dAngleInDegrees > 0) {
      p2dStart=new Point2D.Double(dMinX,dMaxY);
      p2dEnd=new Point2D.Double(dMaxX,dMaxY - (dMaxX - dMinX) * Math.abs(Math.tan(dAngleInRadians)));
    }
 else     if (dAngleInDegrees < 0) {
      p2dStart=new Point2D.Double(dMinX,dMinY);
      p2dEnd=new Point2D.Double(dMaxX,dMinY + (dMaxX - dMinX) * Math.abs(Math.tan(dAngleInRadians)));
    }
 else {
      p2dStart=new Point2D.Double(dMinX,dMinY);
      p2dEnd=new Point2D.Double(dMaxX,dMinY);
    }
    _g2d.setPaint(new GradientPaint(p2dStart,(Color)_ids.getColor(cdStart),p2dEnd,(Color)_ids.getColor(cdEnd)));
    _g2d.fill(new Polygon(i2a[0],i2a[1],loa.length));
  }
 else   if (flBackground instanceof org.eclipse.birt.chart.model.attribute.Image) {
    java.awt.Image img=null;
    if (flBackground instanceof EmbeddedImage) {
      try {
        byte[] data=Base64.decodeBase64(((EmbeddedImage)flBackground).getData().getBytes());
        img=createImage(data);
      }
 catch (      Exception ilex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,ilex);
      }
    }
 else {
      try {
        final String sUrl=((org.eclipse.birt.chart.model.attribute.Image)flBackground).getURL();
        img=(java.awt.Image)_ids.loadImage(new URL(sUrl));
      }
 catch (      ChartException ilex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,ilex);
      }
catch (      MalformedURLException muex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,muex);
      }
    }
    final Shape shClip=_g2d.getClip();
    Area ar2=new Area(new Polygon(i2a[0],i2a[1],loa.length));
    if (shClip != null) {
      Area ar1=new Area(shClip);
      ar2.intersect(ar1);
    }
    _g2d.setClip(ar2);
    final double dMinX=BaseRenderer.getX(loa,IConstants.MIN);
    final double dMaxX=BaseRenderer.getX(loa,IConstants.MAX);
    final double dMinY=BaseRenderer.getY(loa,IConstants.MIN);
    final double dMaxY=BaseRenderer.getY(loa,IConstants.MAX);
    final Size szImage=_ids.getSize(img);
    final int iXRepeat=(int)(Math.ceil((dMaxX - dMinX) / szImage.getWidth()));
    final int iYRepeat=(int)(Math.ceil((dMaxY - dMinY) / szImage.getHeight()));
    final ImageObserver io=(ImageObserver)_ids.getObserver();
    for (int i=0; i < iXRepeat; i++) {
      for (int j=0; j < iYRepeat; j++) {
        _g2d.drawImage(img,(int)(dMinX + i * szImage.getWidth()),(int)(dMinY + j * szImage.getHeight()),io);
      }
    }
    _g2d.setClip(shClip);
  }
}

Fixed version (ground truth):
public void fillPolygon(PolygonRenderEvent pre) throws ChartException {
  iv.modifyEvent(pre);
  final Fill flBackground=validateMultipleFill(pre.getBackground());
  if (isFullTransparent(flBackground)) {
    return;
  }
  final Location[] loa=pre.getPoints();
  final int[][] i2a=getCoordinatesAsInts(loa);
  if (flBackground instanceof ColorDefinition) {
    final ColorDefinition cd=(ColorDefinition)flBackground;
    _g2d.setColor((Color)_ids.getColor(cd));
    _g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_OFF);
    _g2d.fill(new Polygon(i2a[0],i2a[1],loa.length));
    _g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);
  }
 else   if (flBackground instanceof Gradient) {
    final Gradient g=(Gradient)flBackground;
    final ColorDefinition cdStart=g.getStartColor();
    final ColorDefinition cdEnd=g.getEndColor();
    final double dAngleInDegrees=g.getDirection();
    final double dAngleInRadians=((-dAngleInDegrees * Math.PI) / 180.0);
    final double dMinX=BaseRenderer.getX(loa,IConstants.MIN);
    final double dMaxX=BaseRenderer.getX(loa,IConstants.MAX);
    final double dMinY=BaseRenderer.getY(loa,IConstants.MIN);
    final double dMaxY=BaseRenderer.getY(loa,IConstants.MAX);
    if (dAngleInDegrees < -90 || dAngleInDegrees > 90) {
      throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,"String_Node_Str",new Object[]{new Double(dAngleInDegrees)},Messages.getResourceBundle(getULocale()));
    }
    Point2D.Double p2dStart, p2dEnd;
    if (dAngleInDegrees == 90) {
      p2dStart=new Point2D.Double(dMinX,dMaxY);
      p2dEnd=new Point2D.Double(dMinX,dMinY);
    }
 else     if (dAngleInDegrees == -90) {
      p2dStart=new Point2D.Double(dMinX,dMinY);
      p2dEnd=new Point2D.Double(dMinX,dMaxY);
    }
 else     if (dAngleInDegrees > 0) {
      p2dStart=new Point2D.Double(dMinX,dMaxY);
      p2dEnd=new Point2D.Double(dMaxX,dMaxY - (dMaxX - dMinX) * Math.abs(Math.tan(dAngleInRadians)));
    }
 else     if (dAngleInDegrees < 0) {
      p2dStart=new Point2D.Double(dMinX,dMinY);
      p2dEnd=new Point2D.Double(dMaxX,dMinY + (dMaxX - dMinX) * Math.abs(Math.tan(dAngleInRadians)));
    }
 else {
      p2dStart=new Point2D.Double(dMinX,dMinY);
      p2dEnd=new Point2D.Double(dMaxX,dMinY);
    }
    _g2d.setPaint(new GradientPaint(p2dStart,(Color)_ids.getColor(cdStart),p2dEnd,(Color)_ids.getColor(cdEnd)));
    _g2d.fill(new Polygon(i2a[0],i2a[1],loa.length));
  }
 else   if (flBackground instanceof org.eclipse.birt.chart.model.attribute.Image) {
    java.awt.Image img=null;
    if (flBackground instanceof EmbeddedImage) {
      try {
        byte[] data=Base64.decodeBase64(((EmbeddedImage)flBackground).getData().getBytes());
        img=createImage(data);
      }
 catch (      Exception ilex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,ilex);
      }
    }
 else {
      try {
        final String sUrl=((org.eclipse.birt.chart.model.attribute.Image)flBackground).getURL();
        img=(java.awt.Image)_ids.loadImage(new URL(sUrl));
      }
 catch (      ChartException ilex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,ilex);
      }
catch (      MalformedURLException muex) {
        throw new ChartException(ChartDeviceExtensionPlugin.ID,ChartException.RENDERING,muex);
      }
    }
    final Shape shClip=_g2d.getClip();
    Area ar2=new Area(new Polygon(i2a[0],i2a[1],loa.length));
    if (shClip != null) {
      Area ar1=new Area(shClip);
      ar2.intersect(ar1);
    }
    _g2d.setClip(ar2);
    final double dMinX=BaseRenderer.getX(loa,IConstants.MIN);
    final double dMaxX=BaseRenderer.getX(loa,IConstants.MAX);
    final double dMinY=BaseRenderer.getY(loa,IConstants.MIN);
    final double dMaxY=BaseRenderer.getY(loa,IConstants.MAX);
    final Size szImage=_ids.getSize(img);
    final int iXRepeat=(int)(Math.ceil((dMaxX - dMinX) / szImage.getWidth()));
    final int iYRepeat=(int)(Math.ceil((dMaxY - dMinY) / szImage.getHeight()));
    final ImageObserver io=(ImageObserver)_ids.getObserver();
    for (int i=0; i < iXRepeat; i++) {
      for (int j=0; j < iYRepeat; j++) {
        _g2d.drawImage(img,(int)(dMinX + i * szImage.getWidth()),(int)(dMinY + j * szImage.getHeight()),io);
      }
    }
    _g2d.setClip(shClip);
  }
}