Program: 18469
Project: 18469
Buggy source:
protected void drawDataSet(Canvas c,ScatterDataSet dataSet){
  Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
  calcXBounds(trans);
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  List<Entry> entries=dataSet.getYVals();
  float shapeHalf=dataSet.getScatterShapeSize() / 2f;
  ScatterShape shape=dataSet.getScatterShape();
  ScatterBuffer buffer=mScatterBuffers[mChart.getScatterData().getIndexOfDataSet(dataSet)];
  buffer.setPhases(phaseX,phaseY);
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
switch (shape) {
case SQUARE:
    mRenderPaint.setStyle(Style.FILL);
  for (int i=0; i < buffer.size(); i+=2) {
    if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))     break;
    if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))     continue;
    mRenderPaint.setColor(dataSet.getColor(i / 2));
    c.drawRect(buffer.buffer[i] - shapeHalf,buffer.buffer[i + 1] - shapeHalf,buffer.buffer[i] + shapeHalf,buffer.buffer[i + 1] + shapeHalf,mRenderPaint);
  }
break;
case CIRCLE:
mRenderPaint.setStyle(Style.FILL);
for (int i=0; i < buffer.size(); i+=2) {
if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break;
if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue;
mRenderPaint.setColor(dataSet.getColor(i / 2));
c.drawCircle(buffer.buffer[i],buffer.buffer[i + 1],shapeHalf,mRenderPaint);
}
break;
case TRIANGLE:
mRenderPaint.setStyle(Style.FILL);
Path tri=new Path();
for (int i=0; i < buffer.size(); i+=2) {
if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break;
if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue;
mRenderPaint.setColor(dataSet.getColor(i / 2));
tri.moveTo(buffer.buffer[i],buffer.buffer[i + 1] - shapeHalf);
tri.lineTo(buffer.buffer[i] + shapeHalf,buffer.buffer[i + 1] + shapeHalf);
tri.lineTo(buffer.buffer[i] - shapeHalf,buffer.buffer[i + 1] + shapeHalf);
tri.close();
c.drawPath(tri,mRenderPaint);
tri.reset();
}
break;
case CROSS:
mRenderPaint.setStyle(Style.STROKE);
for (int i=0; i < buffer.size(); i+=2) {
if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break;
if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue;
mRenderPaint.setColor(dataSet.getColor(i / 2));
c.drawLine(buffer.buffer[i] - shapeHalf,buffer.buffer[i + 1],buffer.buffer[i] + shapeHalf,buffer.buffer[i + 1],mRenderPaint);
c.drawLine(buffer.buffer[i],buffer.buffer[i + 1] - shapeHalf,buffer.buffer[i],buffer.buffer[i + 1] + shapeHalf,mRenderPaint);
}
break;
default :
break;
}
}

Fixed version (ground truth):
protected void drawDataSet(Canvas c,ScatterDataSet dataSet){
  Transformer trans=mChart.getTransformer(dataSet.getAxisDependency());
  float phaseX=mAnimator.getPhaseX();
  float phaseY=mAnimator.getPhaseY();
  List<Entry> entries=dataSet.getYVals();
  float shapeHalf=dataSet.getScatterShapeSize() / 2f;
  ScatterShape shape=dataSet.getScatterShape();
  ScatterBuffer buffer=mScatterBuffers[mChart.getScatterData().getIndexOfDataSet(dataSet)];
  buffer.setPhases(phaseX,phaseY);
  buffer.feed(entries);
  trans.pointValuesToPixel(buffer.buffer);
switch (shape) {
case SQUARE:
    mRenderPaint.setStyle(Style.FILL);
  for (int i=0; i < buffer.size(); i+=2) {
    if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i]))     break;
    if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1]))     continue;
    mRenderPaint.setColor(dataSet.getColor(i / 2));
    c.drawRect(buffer.buffer[i] - shapeHalf,buffer.buffer[i + 1] - shapeHalf,buffer.buffer[i] + shapeHalf,buffer.buffer[i + 1] + shapeHalf,mRenderPaint);
  }
break;
case CIRCLE:
mRenderPaint.setStyle(Style.FILL);
for (int i=0; i < buffer.size(); i+=2) {
if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break;
if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue;
mRenderPaint.setColor(dataSet.getColor(i / 2));
c.drawCircle(buffer.buffer[i],buffer.buffer[i + 1],shapeHalf,mRenderPaint);
}
break;
case TRIANGLE:
mRenderPaint.setStyle(Style.FILL);
Path tri=new Path();
for (int i=0; i < buffer.size(); i+=2) {
if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break;
if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue;
mRenderPaint.setColor(dataSet.getColor(i / 2));
tri.moveTo(buffer.buffer[i],buffer.buffer[i + 1] - shapeHalf);
tri.lineTo(buffer.buffer[i] + shapeHalf,buffer.buffer[i + 1] + shapeHalf);
tri.lineTo(buffer.buffer[i] - shapeHalf,buffer.buffer[i + 1] + shapeHalf);
tri.close();
c.drawPath(tri,mRenderPaint);
tri.reset();
}
break;
case CROSS:
mRenderPaint.setStyle(Style.STROKE);
for (int i=0; i < buffer.size(); i+=2) {
if (!mViewPortHandler.isInBoundsRight(buffer.buffer[i])) break;
if (!mViewPortHandler.isInBoundsLeft(buffer.buffer[i]) || !mViewPortHandler.isInBoundsY(buffer.buffer[i + 1])) continue;
mRenderPaint.setColor(dataSet.getColor(i / 2));
c.drawLine(buffer.buffer[i] - shapeHalf,buffer.buffer[i + 1],buffer.buffer[i] + shapeHalf,buffer.buffer[i + 1],mRenderPaint);
c.drawLine(buffer.buffer[i],buffer.buffer[i + 1] - shapeHalf,buffer.buffer[i],buffer.buffer[i + 1] + shapeHalf,mRenderPaint);
}
break;
default :
break;
}
}