nus-yam/ex-repair huggingface dataset:
Program: 38429
Project: 38429
Buggy source:
public Bitmap getScaleOneImageForPreset(ImageShow caller,ImagePreset imagePreset,Rect bounds,Rect destination,boolean force){
  mLoadingLock.lock();
  Bitmap bmp=mZoomCache.getImage(imagePreset,bounds);
  if (force || bmp == null) {
    BitmapFactory.Options options=null;
    if (destination != null) {
      options=new BitmapFactory.Options();
      if (bounds.width() > destination.width()) {
        int sampleSize=1;
        int w=bounds.width();
        while (w > destination.width()) {
          sampleSize*=2;
          w/=sampleSize;
        }
        options.inSampleSize=sampleSize;
      }
    }
    bmp=loadRegionBitmap(mUri,options,bounds);
    if (destination != null) {
      mLoadingLock.unlock();
      return bmp;
    }
    if (bmp != null) {
      Bitmap bmp2=bmp.copy(Bitmap.Config.ARGB_8888,true);
      float scaleFactor=imagePreset.getScaleFactor();
      imagePreset.setScaleFactor(1.0f);
      bmp2=imagePreset.apply(bmp2);
      imagePreset.setScaleFactor(scaleFactor);
      mZoomCache.setImage(imagePreset,bounds,bmp2);
      mLoadingLock.unlock();
      return bmp2;
    }
  }
  mLoadingLock.unlock();
  return bmp;
}

Fixed version (ground truth):
public Bitmap getScaleOneImageForPreset(ImageShow caller,ImagePreset imagePreset,Rect bounds,Rect destination,boolean force){
  mLoadingLock.lock();
  Bitmap bmp=mZoomCache.getImage(imagePreset,bounds);
  if (force || bmp == null) {
    BitmapFactory.Options options=null;
    if (destination != null) {
      options=new BitmapFactory.Options();
      if (bounds.width() > destination.width()) {
        int sampleSize=1;
        int w=bounds.width();
        while (w > destination.width()) {
          sampleSize*=2;
          w/=sampleSize;
        }
        options.inSampleSize=sampleSize;
      }
    }
    bmp=loadRegionBitmap(mUri,options,bounds);
    if (destination != null) {
      mLoadingLock.unlock();
      return bmp;
    }
    if (bmp != null) {
      float scaleFactor=imagePreset.getScaleFactor();
      imagePreset.setScaleFactor(1.0f);
      bmp=imagePreset.apply(bmp);
      imagePreset.setScaleFactor(scaleFactor);
      mZoomCache.setImage(imagePreset,bounds,bmp);
      mLoadingLock.unlock();
      return bmp;
    }
  }
  mLoadingLock.unlock();
  return bmp;
}
Program: 38430
Project: 38430
Buggy source:
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,int quality){
  if (bitmap == null) {
    return bitmap;
  }
  try {
    prepare(bitmap,scaleFactor,quality);
    runFilter();
    update(bitmap);
  }
 catch (  android.renderscript.RSIllegalArgumentException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  android.renderscript.RSRuntimeException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
  return bitmap;
}

Fixed version (ground truth):
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,int quality){
  if (bitmap == null) {
    return bitmap;
  }
  try {
    prepare(bitmap,scaleFactor,quality);
    runFilter();
    update(bitmap);
  }
 catch (  android.renderscript.RSIllegalArgumentException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  android.renderscript.RSRuntimeException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  java.lang.OutOfMemoryError e) {
    System.gc();
    displayLowMemoryToast();
    Log.e(LOGTAG,"String_Node_Str" + getName(),e);
  }
  return bitmap;
}
Program: 38432
Project: 38432
Buggy source:
@Override protected void onDestroy(){
  if (mLoadBitmapTask != null) {
    mLoadBitmapTask.cancel(false);
  }
  super.onDestroy();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  if (mLoadBitmapTask != null) {
    mLoadBitmapTask.cancel(false);
  }
  MasterImage.reset();
  FilteringPipeline.reset();
  ImageFilter.reset();
  super.onDestroy();
}
Program: 38433
Project: 38433
Buggy source:
public static FilteringPipeline getPipeline(){
  return gPipeline;
}

Fixed version (ground truth):
public static FilteringPipeline getPipeline(){
  if (sPipeline == null) {
    sPipeline=new FilteringPipeline();
  }
  return sPipeline;
}
Program: 38434
Project: 38434
Buggy source:
public Bitmap getScaleOneImageForPreset(ImageShow caller,ImagePreset imagePreset,Rect bounds,Rect destination,boolean force){
  mLoadingLock.lock();
  Bitmap bmp=mZoomCache.getImage(imagePreset,bounds);
  if (force || bmp == null) {
    BitmapFactory.Options options=null;
    if (destination != null) {
      options=new BitmapFactory.Options();
      if (bounds.width() > destination.width()) {
        int sampleSize=1;
        int w=bounds.width();
        while (w > destination.width()) {
          sampleSize*=2;
          w/=sampleSize;
        }
        options.inSampleSize=sampleSize;
      }
    }
    bmp=loadRegionBitmap(mUri,options,bounds);
    if (destination != null) {
      mLoadingLock.unlock();
      return bmp;
    }
    if (bmp != null) {
      Bitmap bmp2=bmp.copy(Bitmap.Config.ARGB_8888,true);
      float scaleFactor=imagePreset.getScaleFactor();
      imagePreset.setScaleFactor(1.0f);
      bmp2=imagePreset.apply(bmp2);
      imagePreset.setScaleFactor(scaleFactor);
      mZoomCache.setImage(imagePreset,bounds,bmp2);
      mLoadingLock.unlock();
      return bmp2;
    }
  }
  mLoadingLock.unlock();
  return bmp;
}

Fixed version (ground truth):
public Bitmap getScaleOneImageForPreset(ImageShow caller,ImagePreset imagePreset,Rect bounds,Rect destination,boolean force){
  mLoadingLock.lock();
  Bitmap bmp=mZoomCache.getImage(imagePreset,bounds);
  if (force || bmp == null) {
    BitmapFactory.Options options=null;
    if (destination != null) {
      options=new BitmapFactory.Options();
      if (bounds.width() > destination.width()) {
        int sampleSize=1;
        int w=bounds.width();
        while (w > destination.width()) {
          sampleSize*=2;
          w/=sampleSize;
        }
        options.inSampleSize=sampleSize;
      }
    }
    bmp=loadRegionBitmap(mUri,options,bounds);
    if (destination != null) {
      mLoadingLock.unlock();
      return bmp;
    }
    if (bmp != null) {
      float scaleFactor=imagePreset.getScaleFactor();
      imagePreset.setScaleFactor(1.0f);
      bmp=imagePreset.apply(bmp);
      imagePreset.setScaleFactor(scaleFactor);
      mZoomCache.setImage(imagePreset,bounds,bmp);
      mLoadingLock.unlock();
      return bmp;
    }
  }
  mLoadingLock.unlock();
  return bmp;
}
Program: 38435
Project: 38435
Buggy source:
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,int quality){
  if (bitmap == null) {
    return bitmap;
  }
  try {
    prepare(bitmap,scaleFactor,quality);
    runFilter();
    update(bitmap);
  }
 catch (  android.renderscript.RSIllegalArgumentException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  android.renderscript.RSRuntimeException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
  return bitmap;
}

Fixed version (ground truth):
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,int quality){
  if (bitmap == null) {
    return bitmap;
  }
  try {
    prepare(bitmap,scaleFactor,quality);
    runFilter();
    update(bitmap);
  }
 catch (  android.renderscript.RSIllegalArgumentException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  android.renderscript.RSRuntimeException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  java.lang.OutOfMemoryError e) {
    System.gc();
    displayLowMemoryToast();
    Log.e(LOGTAG,"String_Node_Str" + getName(),e);
  }
  return bitmap;
}
Program: 38437
Project: 38437
Buggy source:
@Override protected void onDestroy(){
  if (mLoadBitmapTask != null) {
    mLoadBitmapTask.cancel(false);
  }
  super.onDestroy();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  if (mLoadBitmapTask != null) {
    mLoadBitmapTask.cancel(false);
  }
  MasterImage.reset();
  FilteringPipeline.reset();
  ImageFilter.resetStatics();
  super.onDestroy();
}
Program: 38438
Project: 38438
Buggy source:
public static FilteringPipeline getPipeline(){
  return gPipeline;
}

Fixed version (ground truth):
public static FilteringPipeline getPipeline(){
  if (sPipeline == null) {
    sPipeline=new FilteringPipeline();
  }
  return sPipeline;
}
Program: 38439
Project: 38439
Buggy source:
public Bitmap getScaleOneImageForPreset(ImageShow caller,ImagePreset imagePreset,Rect bounds,Rect destination,boolean force){
  mLoadingLock.lock();
  Bitmap bmp=mZoomCache.getImage(imagePreset,bounds);
  if (force || bmp == null) {
    BitmapFactory.Options options=null;
    if (destination != null) {
      options=new BitmapFactory.Options();
      if (bounds.width() > destination.width()) {
        int sampleSize=1;
        int w=bounds.width();
        while (w > destination.width()) {
          sampleSize*=2;
          w/=sampleSize;
        }
        options.inSampleSize=sampleSize;
      }
    }
    bmp=loadRegionBitmap(mUri,options,bounds);
    if (bmp != null) {
      Bitmap bmp2=bmp.copy(Bitmap.Config.ARGB_8888,true);
      float scaleFactor=imagePreset.getScaleFactor();
      imagePreset.setScaleFactor(1.0f);
      bmp2=imagePreset.apply(bmp2);
      imagePreset.setScaleFactor(scaleFactor);
      mZoomCache.setImage(imagePreset,bounds,bmp2);
      mLoadingLock.unlock();
      return bmp2;
    }
  }
  mLoadingLock.unlock();
  return bmp;
}

Fixed version (ground truth):
public Bitmap getScaleOneImageForPreset(ImageShow caller,ImagePreset imagePreset,Rect bounds,Rect destination,boolean force){
  mLoadingLock.lock();
  Bitmap bmp=mZoomCache.getImage(imagePreset,bounds);
  if (force || bmp == null) {
    BitmapFactory.Options options=null;
    if (destination != null) {
      options=new BitmapFactory.Options();
      if (bounds.width() > destination.width()) {
        int sampleSize=1;
        int w=bounds.width();
        while (w > destination.width()) {
          sampleSize*=2;
          w/=sampleSize;
        }
        options.inSampleSize=sampleSize;
      }
    }
    bmp=loadRegionBitmap(mUri,options,bounds);
    if (bmp != null) {
      float scaleFactor=imagePreset.getScaleFactor();
      imagePreset.setScaleFactor(1.0f);
      bmp=imagePreset.apply(bmp);
      imagePreset.setScaleFactor(scaleFactor);
      mZoomCache.setImage(imagePreset,bounds,bmp);
      mLoadingLock.unlock();
      return bmp;
    }
  }
  mLoadingLock.unlock();
  return bmp;
}
Program: 38440
Project: 38440
Buggy source:
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,int quality){
  if (bitmap == null) {
    return bitmap;
  }
  try {
    prepare(bitmap,scaleFactor,quality);
    runFilter();
    update(bitmap);
  }
 catch (  android.renderscript.RSIllegalArgumentException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  android.renderscript.RSRuntimeException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
  return bitmap;
}

Fixed version (ground truth):
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,int quality){
  if (bitmap == null) {
    return bitmap;
  }
  try {
    prepare(bitmap,scaleFactor,quality);
    runFilter();
    update(bitmap);
  }
 catch (  android.renderscript.RSIllegalArgumentException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  android.renderscript.RSRuntimeException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  java.lang.OutOfMemoryError e) {
    System.gc();
    displayLowMemoryToast();
    Log.e(LOGTAG,"String_Node_Str" + getName(),e);
  }
  return bitmap;
}
Program: 38442
Project: 38442
Buggy source:
@Override protected void onDestroy(){
  if (mLoadBitmapTask != null) {
    mLoadBitmapTask.cancel(false);
  }
  super.onDestroy();
}

Fixed version (ground truth):
@Override protected void onDestroy(){
  if (mLoadBitmapTask != null) {
    mLoadBitmapTask.cancel(false);
  }
  MasterImage.reset();
  FilteringPipeline.reset();
  ImageFilter.reset();
  super.onDestroy();
}
Program: 38443
Project: 38443
Buggy source:
public static FilteringPipeline getPipeline(){
  return gPipeline;
}

Fixed version (ground truth):
public static FilteringPipeline getPipeline(){
  if (sPipeline == null) {
    sPipeline=new FilteringPipeline();
  }
  return sPipeline;
}
Program: 38444
Project: 38444
Buggy source:
public Bitmap getScaleOneImageForPreset(ImageShow caller,ImagePreset imagePreset,Rect bounds,Rect destination,boolean force){
  mLoadingLock.lock();
  Bitmap bmp=mZoomCache.getImage(imagePreset,bounds);
  if (force || bmp == null) {
    BitmapFactory.Options options=null;
    if (destination != null) {
      options=new BitmapFactory.Options();
      if (bounds.width() > destination.width()) {
        int sampleSize=1;
        int w=bounds.width();
        while (w > destination.width()) {
          sampleSize*=2;
          w/=sampleSize;
        }
        options.inSampleSize=sampleSize;
      }
    }
    bmp=loadRegionBitmap(mUri,options,bounds);
    if (bmp != null) {
      Bitmap bmp2=bmp.copy(Bitmap.Config.ARGB_8888,true);
      float scaleFactor=imagePreset.getScaleFactor();
      imagePreset.setScaleFactor(1.0f);
      bmp2=imagePreset.apply(bmp2);
      imagePreset.setScaleFactor(scaleFactor);
      mZoomCache.setImage(imagePreset,bounds,bmp2);
      mLoadingLock.unlock();
      return bmp2;
    }
  }
  mLoadingLock.unlock();
  return bmp;
}

Fixed version (ground truth):
public Bitmap getScaleOneImageForPreset(ImageShow caller,ImagePreset imagePreset,Rect bounds,Rect destination,boolean force){
  mLoadingLock.lock();
  Bitmap bmp=mZoomCache.getImage(imagePreset,bounds);
  if (force || bmp == null) {
    BitmapFactory.Options options=null;
    if (destination != null) {
      options=new BitmapFactory.Options();
      if (bounds.width() > destination.width()) {
        int sampleSize=1;
        int w=bounds.width();
        while (w > destination.width()) {
          sampleSize*=2;
          w/=sampleSize;
        }
        options.inSampleSize=sampleSize;
      }
    }
    bmp=loadRegionBitmap(mUri,options,bounds);
    if (bmp != null) {
      float scaleFactor=imagePreset.getScaleFactor();
      imagePreset.setScaleFactor(1.0f);
      bmp=imagePreset.apply(bmp);
      imagePreset.setScaleFactor(scaleFactor);
      mZoomCache.setImage(imagePreset,bounds,bmp);
      mLoadingLock.unlock();
      return bmp;
    }
  }
  mLoadingLock.unlock();
  return bmp;
}
Program: 38445
Project: 38445
Buggy source:
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,int quality){
  if (bitmap == null) {
    return bitmap;
  }
  try {
    prepare(bitmap,scaleFactor,quality);
    runFilter();
    update(bitmap);
  }
 catch (  android.renderscript.RSIllegalArgumentException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  android.renderscript.RSRuntimeException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
  return bitmap;
}

Fixed version (ground truth):
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,int quality){
  if (bitmap == null) {
    return bitmap;
  }
  try {
    prepare(bitmap,scaleFactor,quality);
    runFilter();
    update(bitmap);
  }
 catch (  android.renderscript.RSIllegalArgumentException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  android.renderscript.RSRuntimeException e) {
    Log.e(LOGTAG,"String_Node_Str" + e);
  }
catch (  java.lang.OutOfMemoryError e) {
    System.gc();
    displayLowMemoryToast();
    Log.e(LOGTAG,"String_Node_Str" + getName(),e);
  }
  return bitmap;
}
Program: 38446
Project: 38446
Buggy source:
public void setRepresentation(FilterVignetteRepresentation vignetteRep){
  mVignetteRep=vignetteRep;
  Matrix toImg=getScreenToImageMatrix(false);
  Matrix toScr=new Matrix();
  toImg.invert(toScr);
  float[] c=new float[]{mVignetteRep.getCenterX(),mVignetteRep.getCenterY()};
  if (Float.isNaN(c[0])) {
    float cx=mImageLoader.getOriginalBounds().width() / 2;
    float cy=mImageLoader.getOriginalBounds().height() / 2;
    float rx=cx * .8f;
    float ry=cy * .8f;
    mVignetteRep.setCenter(cx,cy);
    mVignetteRep.setRadius(rx,ry);
    c[0]=cx;
    c[1]=cy;
    toScr.mapPoints(c);
    mElipse.setCenter(c[0],c[1]);
    mElipse.setRadius(c[0] * 0.8f,c[1] * 0.8f);
  }
 else {
    toScr.mapPoints(c);
    mElipse.setCenter(c[0],c[1]);
    mElipse.setRadius(toScr.mapRadius(mVignetteRep.getRadiusX()),toScr.mapRadius(mVignetteRep.getRadiusY()));
  }
}

Fixed version (ground truth):
public void setRepresentation(FilterVignetteRepresentation vignetteRep){
  mVignetteRep=vignetteRep;
  Matrix toImg=getScreenToImageMatrix(false);
  Matrix toScr=new Matrix();
  toImg.invert(toScr);
  float[] c=new float[]{mVignetteRep.getCenterX(),mVignetteRep.getCenterY()};
  if (Float.isNaN(c[0])) {
    float cx=mImageLoader.getOriginalBounds().width() / 2;
    float cy=mImageLoader.getOriginalBounds().height() / 2;
    float rx=Math.min(cx,cy) * .8f;
    float ry=rx;
    mVignetteRep.setCenter(cx,cy);
    mVignetteRep.setRadius(rx,ry);
    c[0]=cx;
    c[1]=cy;
    toScr.mapPoints(c);
    if (getWidth() != 0) {
      mElipse.setCenter(c[0],c[1]);
      mElipse.setRadius(c[0] * 0.8f,c[1] * 0.8f);
    }
  }
 else {
    toScr.mapPoints(c);
    mElipse.setCenter(c[0],c[1]);
    mElipse.setRadius(toScr.mapRadius(mVignetteRep.getRadiusX()),toScr.mapRadius(mVignetteRep.getRadiusY()));
  }
}
Program: 38447
Project: 38447
Buggy source:
@Override public void onDraw(Canvas canvas){
  super.onDraw(canvas);
  mElipse.draw(canvas);
}

Fixed version (ground truth):
@Override public void onDraw(Canvas canvas){
  super.onDraw(canvas);
  if (mElipse.isUndefined()) {
    setRepresentation(mVignetteRep);
  }
  mElipse.draw(canvas);
}
Program: 38449
Project: 38449
Buggy source:
@Override public boolean onMenuItemClick(MenuItem item){
  ImageFilterDraw filter=(ImageFilterDraw)mImageShow.getCurrentFilter();
  if (item.getItemId() == R.id.draw_menu_color) {
    showColorGrid(item);
  }
 else   if (item.getItemId() == R.id.draw_menu_size) {
    showSizeDialog(item);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_brush_marker) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.BRUSH_STYLE_MARKER);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_brush_spatter) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.BRUSH_STYLE_SPATTER);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_line) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.SIMPLE_STYLE);
  }
 else   if (item.getItemId() == R.id.draw_menu_clear) {
    FilterDrawRepresentation drawRep=(FilterDrawRepresentation)getLocalRepresentation();
    drawRep.clear();
    commitLocalRepresentation();
  }
  mView.invalidate();
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemClick(MenuItem item){
  ImageFilterDraw filter=(ImageFilterDraw)mImageShow.getCurrentFilter();
  if (item.getItemId() == R.id.draw_menu_color) {
    showColorGrid(item);
  }
 else   if (item.getItemId() == R.id.draw_menu_size) {
    showSizeDialog(item);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_brush_marker) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.BRUSH_STYLE_MARKER);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_brush_spatter) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.BRUSH_STYLE_SPATTER);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_line) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.SIMPLE_STYLE);
  }
 else   if (item.getItemId() == R.id.draw_menu_clear) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.resetParameter();
    commitLocalRepresentation();
  }
  mView.invalidate();
  return true;
}
Program: 38450
Project: 38450
Buggy source:
@Override public void useParametersFrom(FilterRepresentation a){
  if (a instanceof FilterDrawRepresentation) {
    FilterDrawRepresentation representation=(FilterDrawRepresentation)a;
    try {
      if (representation.mCurrent != null) {
        mCurrent=(StrokeData)representation.mCurrent.clone();
      }
 else {
        mCurrent=null;
      }
      if (representation.mDrawing != null) {
        mDrawing=(Vector<StrokeData>)representation.mDrawing.clone();
      }
    }
 catch (    CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
 else {
    Log.v(LOGTAG,"String_Node_Str" + a);
  }
}

Fixed version (ground truth):
@Override public void useParametersFrom(FilterRepresentation a){
  if (a instanceof FilterDrawRepresentation) {
    FilterDrawRepresentation representation=(FilterDrawRepresentation)a;
    try {
      if (representation.mCurrent != null) {
        mCurrent=(StrokeData)representation.mCurrent.clone();
      }
 else {
        mCurrent=null;
      }
      if (representation.mDrawing != null) {
        mDrawing=(Vector<StrokeData>)representation.mDrawing.clone();
      }
 else {
        mDrawing=null;
      }
    }
 catch (    CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
 else {
    Log.v(LOGTAG,"String_Node_Str" + a);
  }
}
Program: 38451
Project: 38451
Buggy source:
public void drawData(Canvas canvas,Matrix originalRotateToScreen,int quality){
  Paint paint=new Paint();
  if (quality == ImagePreset.QUALITY_FINAL) {
    paint.setAntiAlias(true);
  }
  paint.setStyle(Style.STROKE);
  paint.setColor(Color.RED);
  paint.setStrokeWidth(40);
  if (mParameters.getDrawing().isEmpty() && mParameters.getCurrentDrawing() == null) {
    return;
  }
  if (quality == ImagePreset.QUALITY_FINAL) {
    for (    FilterDrawRepresentation.StrokeData strokeData : mParameters.getDrawing()) {
      paint(strokeData,canvas,originalRotateToScreen,quality);
    }
    return;
  }
  if (mOverlayBitmap == null || mOverlayBitmap.getWidth() != canvas.getWidth() || mOverlayBitmap.getHeight() != canvas.getHeight()) {
    mOverlayBitmap=Bitmap.createBitmap(canvas.getWidth(),canvas.getHeight(),Bitmap.Config.ARGB_8888);
    mCachedStrokes=0;
  }
  if (mCachedStrokes < mParameters.getDrawing().size()) {
    fillBuffer(originalRotateToScreen);
  }
  canvas.drawBitmap(mOverlayBitmap,0,0,paint);
  StrokeData stroke=mParameters.getCurrentDrawing();
  if (stroke != null) {
    paint(stroke,canvas,originalRotateToScreen,quality);
  }
}

Fixed version (ground truth):
public void drawData(Canvas canvas,Matrix originalRotateToScreen,int quality){
  Paint paint=new Paint();
  if (quality == ImagePreset.QUALITY_FINAL) {
    paint.setAntiAlias(true);
  }
  paint.setStyle(Style.STROKE);
  paint.setColor(Color.RED);
  paint.setStrokeWidth(40);
  if (mParameters.getDrawing().isEmpty() && mParameters.getCurrentDrawing() == null) {
    return;
  }
  if (quality == ImagePreset.QUALITY_FINAL) {
    for (    FilterDrawRepresentation.StrokeData strokeData : mParameters.getDrawing()) {
      paint(strokeData,canvas,originalRotateToScreen,quality);
    }
    return;
  }
  if (mOverlayBitmap == null || mOverlayBitmap.getWidth() != canvas.getWidth() || mOverlayBitmap.getHeight() != canvas.getHeight() || mParameters.getDrawing().size() < mCachedStrokes) {
    mOverlayBitmap=Bitmap.createBitmap(canvas.getWidth(),canvas.getHeight(),Bitmap.Config.ARGB_8888);
    mCachedStrokes=0;
  }
  if (mCachedStrokes < mParameters.getDrawing().size()) {
    fillBuffer(originalRotateToScreen);
  }
  canvas.drawBitmap(mOverlayBitmap,0,0,paint);
  StrokeData stroke=mParameters.getCurrentDrawing();
  if (stroke != null) {
    paint(stroke,canvas,originalRotateToScreen,quality);
  }
}
Program: 38452
Project: 38452
Buggy source:
@Override public void useParametersFrom(FilterRepresentation a){
  if (a instanceof FilterDrawRepresentation) {
    FilterDrawRepresentation representation=(FilterDrawRepresentation)a;
    try {
      if (representation.mCurrent != null) {
        mCurrent=(StrokeData)representation.mCurrent.clone();
      }
 else {
        mCurrent=null;
      }
      if (representation.mDrawing != null) {
        mDrawing=(Vector<StrokeData>)representation.mDrawing.clone();
      }
    }
 catch (    CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
 else {
    Log.v(LOGTAG,"String_Node_Str" + a);
  }
}

Fixed version (ground truth):
@Override public void useParametersFrom(FilterRepresentation a){
  if (a instanceof FilterDrawRepresentation) {
    FilterDrawRepresentation representation=(FilterDrawRepresentation)a;
    try {
      if (representation.mCurrent != null) {
        mCurrent=(StrokeData)representation.mCurrent.clone();
      }
 else {
        mCurrent=null;
      }
      if (representation.mDrawing != null) {
        mDrawing=(Vector<StrokeData>)representation.mDrawing.clone();
      }
 else {
        mDrawing=null;
      }
    }
 catch (    CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
 else {
    Log.v(LOGTAG,"String_Node_Str" + a);
  }
}
Program: 38454
Project: 38454
Buggy source:
@Override public boolean onMenuItemClick(MenuItem item){
  ImageFilterDraw filter=(ImageFilterDraw)mImageShow.getCurrentFilter();
  if (item.getItemId() == R.id.draw_menu_color) {
    showColorGrid(item);
  }
 else   if (item.getItemId() == R.id.draw_menu_size) {
    showSizeDialog(item);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_brush_marker) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.BRUSH_STYLE_MARKER);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_brush_spatter) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.BRUSH_STYLE_SPATTER);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_line) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.SIMPLE_STYLE);
  }
 else   if (item.getItemId() == R.id.draw_menu_clear) {
    FilterDrawRepresentation drawRep=(FilterDrawRepresentation)getLocalRepresentation();
    drawRep.clear();
    commitLocalRepresentation();
  }
  mView.invalidate();
  return true;
}

Fixed version (ground truth):
@Override public boolean onMenuItemClick(MenuItem item){
  ImageFilterDraw filter=(ImageFilterDraw)mImageShow.getCurrentFilter();
  if (item.getItemId() == R.id.draw_menu_color) {
    showColorGrid(item);
  }
 else   if (item.getItemId() == R.id.draw_menu_size) {
    showSizeDialog(item);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_brush_marker) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.BRUSH_STYLE_MARKER);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_brush_spatter) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.BRUSH_STYLE_SPATTER);
  }
 else   if (item.getItemId() == R.id.draw_menu_style_line) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.setStyle(ImageFilterDraw.SIMPLE_STYLE);
  }
 else   if (item.getItemId() == R.id.draw_menu_clear) {
    ImageDraw idraw=(ImageDraw)mImageShow;
    idraw.resetParameter();
    commitLocalRepresentation();
  }
  mView.invalidate();
  return true;
}
Program: 38455
Project: 38455
Buggy source:
@Override public void useParametersFrom(FilterRepresentation a){
  if (a instanceof FilterDrawRepresentation) {
    FilterDrawRepresentation representation=(FilterDrawRepresentation)a;
    try {
      if (representation.mCurrent != null) {
        mCurrent=(StrokeData)representation.mCurrent.clone();
      }
 else {
        mCurrent=null;
      }
      if (representation.mDrawing != null) {
        mDrawing=(Vector<StrokeData>)representation.mDrawing.clone();
      }
    }
 catch (    CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
 else {
    Log.v(LOGTAG,"String_Node_Str" + a);
  }
}

Fixed version (ground truth):
@Override public void useParametersFrom(FilterRepresentation a){
  if (a instanceof FilterDrawRepresentation) {
    FilterDrawRepresentation representation=(FilterDrawRepresentation)a;
    try {
      if (representation.mCurrent != null) {
        mCurrent=(StrokeData)representation.mCurrent.clone();
      }
 else {
        mCurrent=null;
      }
      if (representation.mDrawing != null) {
        mDrawing=(Vector<StrokeData>)representation.mDrawing.clone();
      }
 else {
        mDrawing=null;
      }
    }
 catch (    CloneNotSupportedException e) {
      e.printStackTrace();
    }
  }
 else {
    Log.v(LOGTAG,"String_Node_Str" + a);
  }
}
Program: 38456
Project: 38456
Buggy source:
public void drawData(Canvas canvas,Matrix originalRotateToScreen,int quality){
  Paint paint=new Paint();
  if (quality == ImagePreset.QUALITY_FINAL) {
    paint.setAntiAlias(true);
  }
  paint.setStyle(Style.STROKE);
  paint.setColor(Color.RED);
  paint.setStrokeWidth(40);
  if (mParameters.getDrawing().isEmpty() && mParameters.getCurrentDrawing() == null) {
    return;
  }
  if (quality == ImagePreset.QUALITY_FINAL) {
    for (    FilterDrawRepresentation.StrokeData strokeData : mParameters.getDrawing()) {
      paint(strokeData,canvas,originalRotateToScreen,quality);
    }
    return;
  }
  if (mOverlayBitmap == null || mOverlayBitmap.getWidth() != canvas.getWidth() || mOverlayBitmap.getHeight() != canvas.getHeight()) {
    mOverlayBitmap=Bitmap.createBitmap(canvas.getWidth(),canvas.getHeight(),Bitmap.Config.ARGB_8888);
    mCachedStrokes=0;
  }
  if (mCachedStrokes < mParameters.getDrawing().size()) {
    fillBuffer(originalRotateToScreen);
  }
  canvas.drawBitmap(mOverlayBitmap,0,0,paint);
  StrokeData stroke=mParameters.getCurrentDrawing();
  if (stroke != null) {
    paint(stroke,canvas,originalRotateToScreen,quality);
  }
}

Fixed version (ground truth):
public void drawData(Canvas canvas,Matrix originalRotateToScreen,int quality){
  Paint paint=new Paint();
  if (quality == ImagePreset.QUALITY_FINAL) {
    paint.setAntiAlias(true);
  }
  paint.setStyle(Style.STROKE);
  paint.setColor(Color.RED);
  paint.setStrokeWidth(40);
  if (mParameters.getDrawing().isEmpty() && mParameters.getCurrentDrawing() == null) {
    return;
  }
  if (quality == ImagePreset.QUALITY_FINAL) {
    for (    FilterDrawRepresentation.StrokeData strokeData : mParameters.getDrawing()) {
      paint(strokeData,canvas,originalRotateToScreen,quality);
    }
    return;
  }
  if (mOverlayBitmap == null || mOverlayBitmap.getWidth() != canvas.getWidth() || mOverlayBitmap.getHeight() != canvas.getHeight() || mParameters.getDrawing().size() < mCachedStrokes) {
    mOverlayBitmap=Bitmap.createBitmap(canvas.getWidth(),canvas.getHeight(),Bitmap.Config.ARGB_8888);
    mCachedStrokes=0;
  }
  if (mCachedStrokes < mParameters.getDrawing().size()) {
    fillBuffer(originalRotateToScreen);
  }
  canvas.drawBitmap(mOverlayBitmap,0,0,paint);
  StrokeData stroke=mParameters.getCurrentDrawing();
  if (stroke != null) {
    paint(stroke,canvas,originalRotateToScreen,quality);
  }
}
Program: 38457
Project: 38457
Buggy source:
@Override public boolean onTouchEvent(MotionEvent event){
  float ox=mDotX;
  float oy=mDotY;
  float x=event.getX();
  float y=event.getY();
  mDotX=x;
  if (mDotX < mBorder) {
    mDotX=mBorder;
  }
  if (mDotX > mWidth - mBorder) {
    mDotX=mWidth - mBorder;
  }
  mHSVO[3]=(mDotX - mBorder) / (mWidth - mBorder * 2);
  notifyColorListeners(mHSVO);
  setupButton();
  invalidate((int)(ox - mDotRadus),(int)(oy - mDotRadus),(int)(ox + mDotRadus),(int)(oy + mDotRadus));
  invalidate((int)(mDotX - mDotRadus),(int)(mDotY - mDotRadus),(int)(mDotX + mDotRadus),(int)(mDotY + mDotRadus));
  return true;
}

Fixed version (ground truth):
@Override public boolean onTouchEvent(MotionEvent event){
  float ox=mDotX;
  float oy=mDotY;
  float x=event.getX();
  float y=event.getY();
  mDotX=x;
  if (mDotX < mBorder) {
    mDotX=mBorder;
  }
  if (mDotX > mWidth - mBorder) {
    mDotX=mWidth - mBorder;
  }
  mHSVO[3]=(mDotX - mBorder) / (mWidth - mBorder * 2);
  notifyColorListeners(mHSVO);
  setupButton();
  invalidate((int)(ox - mDotRadius),(int)(oy - mDotRadius),(int)(ox + mDotRadius),(int)(oy + mDotRadius));
  invalidate((int)(mDotX - mDotRadius),(int)(mDotY - mDotRadius),(int)(mDotX + mDotRadius),(int)(mDotY + mDotRadius));
  return true;
}
Program: 38458
Project: 38458
Buggy source:
public ColorOpacityView(Context ctx,AttributeSet attrs){
  super(ctx,attrs);
  DisplayMetrics metrics=ctx.getResources().getDisplayMetrics();
  float mDpToPix=metrics.density;
  mDotRadus=DOT_SIZE * mDpToPix;
  mBorder=BORDER_SIZE * mDpToPix;
  mBarPaint1=new Paint();
  mDotPaint=new Paint();
  mDotPaint.setStyle(Paint.Style.FILL);
  mDotPaint.setColor(ctx.getResources().getColor(R.color.slider_dot_color));
  mSliderColor=ctx.getResources().getColor(R.color.slider_line_color);
  mBarPaint1.setStyle(Paint.Style.FILL);
  mLinePaint1=new Paint();
  mLinePaint1.setColor(Color.GRAY);
  mLinePaint2=new Paint();
  mLinePaint2.setColor(mSliderColor);
  mLinePaint2.setStrokeWidth(4);
  int[] colors=new int[16 * 16];
  for (int i=0; i < colors.length; i++) {
    int y=i / (16 * 8);
    int x=(i / 8) % 2;
    colors[i]=(x == y) ? 0xFFAAAAAA : 0xFF444444;
  }
  Bitmap bitmap=Bitmap.createBitmap(colors,16,16,Bitmap.Config.ARGB_8888);
  BitmapShader bs=new BitmapShader(bitmap,Shader.TileMode.REPEAT,Shader.TileMode.REPEAT);
  mCheckPaint=new Paint();
  mCheckPaint.setShader(bs);
}

Fixed version (ground truth):
public ColorOpacityView(Context ctx,AttributeSet attrs){
  super(ctx,attrs);
  DisplayMetrics metrics=ctx.getResources().getDisplayMetrics();
  float mDpToPix=metrics.density;
  mDotRadius=DOT_SIZE * mDpToPix;
  mBorder=BORDER_SIZE * mDpToPix;
  mBarPaint1=new Paint();
  mDotPaint=new Paint();
  mDotPaint.setStyle(Paint.Style.FILL);
  mDotPaint.setColor(ctx.getResources().getColor(R.color.slider_dot_color));
  mSliderColor=ctx.getResources().getColor(R.color.slider_line_color);
  mBarPaint1.setStyle(Paint.Style.FILL);
  mLinePaint1=new Paint();
  mLinePaint1.setColor(Color.GRAY);
  mLinePaint2=new Paint();
  mLinePaint2.setColor(mSliderColor);
  mLinePaint2.setStrokeWidth(4);
  int[] colors=new int[16 * 16];
  for (int i=0; i < colors.length; i++) {
    int y=i / (16 * 8);
    int x=(i / 8) % 2;
    colors[i]=(x == y) ? 0xFFAAAAAA : 0xFF444444;
  }
  Bitmap bitmap=Bitmap.createBitmap(colors,16,16,Bitmap.Config.ARGB_8888);
  BitmapShader bs=new BitmapShader(bitmap,Shader.TileMode.REPEAT,Shader.TileMode.REPEAT);
  mCheckPaint=new Paint();
  mCheckPaint.setShader(bs);
}
Program: 38459
Project: 38459
Buggy source:
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  canvas.drawColor(mBgcolor);
  canvas.drawRect(mBorder,mBorder,mWidth - mBorder,mHeight - mBorder,mCheckPaint);
  canvas.drawRect(mBorder,mBorder,mWidth - mBorder,mHeight - mBorder,mBarPaint1);
  canvas.drawLine(mDotX,mDotY,mWidth - mBorder,mDotY,mLinePaint1);
  canvas.drawLine(mBorder,mDotY,mDotX,mDotY,mLinePaint2);
  if (mDotX != Float.NaN) {
    canvas.drawCircle(mDotX,mDotY,mDotRadus,mDotPaint);
  }
}

Fixed version (ground truth):
@Override protected void onDraw(Canvas canvas){
  super.onDraw(canvas);
  canvas.drawColor(mBgcolor);
  canvas.drawRect(mBorder,mBorder,mWidth - mBorder,mHeight - mBorder,mCheckPaint);
  canvas.drawRect(mBorder,mBorder,mWidth - mBorder,mHeight - mBorder,mBarPaint1);
  canvas.drawLine(mDotX,mDotY,mWidth - mBorder,mDotY,mLinePaint1);
  canvas.drawLine(mBorder,mDotY,mDotX,mDotY,mLinePaint2);
  if (mDotX != Float.NaN) {
    canvas.drawCircle(mDotX,mDotY,mDotRadius,mDotPaint);
  }
}
Program: 38460
Project: 38460
Buggy source:
private void setupButton(){
  float pos=mHSVO[3] * (mWidth - mBorder * 2);
  mDotX=pos + mBorder;
  int[] colors3=new int[]{mSliderColor,mSliderColor,0x66000000,0};
  RadialGradient g=new RadialGradient(mDotX,mDotY,mDotRadus,colors3,new float[]{0,.3f,.31f,1},Shader.TileMode.CLAMP);
  mDotPaint.setShader(g);
}

Fixed version (ground truth):
private void setupButton(){
  float pos=mHSVO[3] * (mWidth - mBorder * 2);
  mDotX=pos + mBorder;
  int[] colors3=new int[]{mSliderColor,mSliderColor,0x66000000,0};
  RadialGradient g=new RadialGradient(mDotX,mDotY,mDotRadius,colors3,new float[]{0,.3f,.31f,1},Shader.TileMode.CLAMP);
  mDotPaint.setShader(g);
}
Program: 38461
Project: 38461
Buggy source:
@Override public void paintCurrentStroke(Canvas canvas,Matrix toScrMatrix,boolean highQuality){
  Path path=mCurrentPath;
  if (path == null) {
    return;
  }
  Paint paint=new Paint();
  canvas.save();
  canvas.concat(toScrMatrix);
  paint.setStyle(Style.STROKE);
  float scale=toScrMatrix.mapRadius(1);
  draw(canvas,paint,mCurrentColor,mCurrentRadius,path);
  canvas.restore();
}

Fixed version (ground truth):
@Override public void paintCurrentStroke(Canvas canvas,Matrix toScrMatrix,boolean highQuality){
  Path path=mCurrentPath;
  if (path == null) {
    return;
  }
  Paint paint=new Paint();
  paint.setStyle(Style.STROKE);
  float scale=toScrMatrix.mapRadius(1);
  Path mCacheTransPath=new Path();
  mCacheTransPath.addPath(path,toScrMatrix);
  draw(canvas,paint,mCurrentColor,toScrMatrix.mapRadius(mCurrentRadius),mCacheTransPath);
}
Program: 38463
Project: 38463
Buggy source:
@Override public ImageFilter clone() throws CloneNotSupportedException {
  ImageFilterCurves filter=(ImageFilterCurves)super.clone();
  for (int i=0; i < 4; i++) {
    if (mSplines[i] != null) {
      filter.setSpline(mSplines[i],i);
    }
  }
  return filter;
}

Fixed version (ground truth):
@Override public ImageFilter clone() throws CloneNotSupportedException {
  ImageFilterCurves filter=(ImageFilterCurves)super.clone();
  filter.mSplines=new Spline[4];
  for (int i=0; i < 4; i++) {
    if (mSplines[i] != null) {
      filter.setSpline(mSplines[i],i);
    }
  }
  return filter;
}
Program: 38464
Project: 38464
Buggy source:
public void reset(){
  Spline spline=new Spline();
  spline.addPoint(0.0f,1.0f);
  spline.addPoint(1.0f,0.0f);
  for (int i=0; i < 4; i++) {
    mSplines[i]=new Spline(spline);
  }
}

Fixed version (ground truth):
@Override public void reset(){
  Spline spline=new Spline();
  spline.addPoint(0.0f,1.0f);
  spline.addPoint(1.0f,0.0f);
  for (int i=0; i < 4; i++) {
    mSplines[i]=new Spline(spline);
  }
}
Program: 38465
Project: 38465
Buggy source:
public static void addEditors(EditorPlaceHolder editorPlaceHolder){
  editorPlaceHolder.addEditor(new EditorZoom());
  editorPlaceHolder.addEditor(new EditorCurves());
  editorPlaceHolder.addEditor(new BasicEditor());
  editorPlaceHolder.addEditor(new EditorDraw());
}

Fixed version (ground truth):
public static void addEditors(EditorPlaceHolder editorPlaceHolder){
  editorPlaceHolder.addEditor(new EditorZoom());
  editorPlaceHolder.addEditor(new EditorCurves());
  editorPlaceHolder.addEditor(new EditorDraw());
}
Program: 38466
Project: 38466
Buggy source:
void resetHistory(){
  mNullFxFilter.onClick(mNullFxFilter);
  mNullBorderFilter.onClick(mNullBorderFilter);
  HistoryAdapter adapter=mImageShow.getHistory();
  adapter.reset();
  ImagePreset original=new ImagePreset(adapter.getItem(0));
  mImageShow.setImagePreset(original);
  mPanelController.resetParameters();
  invalidateViews();
}

Fixed version (ground truth):
void resetHistory(){
  dispatchNullFilterClick();
  HistoryAdapter adapter=mImageShow.getHistory();
  adapter.reset();
  ImagePreset original=new ImagePreset(adapter.getItem(0));
  mImageShow.setImagePreset(original);
  mPanelController.resetParameters();
  invalidateViews();
}
Program: 38467
Project: 38467
Buggy source:
@Override protected void onPostExecute(Boolean result){
  if (isCancelled()) {
    return;
  }
  if (!result) {
    cannotLoadImage();
  }
  mLoadBitmapTask=null;
  super.onPostExecute(result);
}

Fixed version (ground truth):
@Override protected void onPostExecute(Boolean result){
  if (isCancelled()) {
    return;
  }
  if (!result) {
    cannotLoadImage();
  }
  mImageShow.requestFilteredImages();
  Bitmap bmap=mImageShow.getFilteredImage();
  if (bmap != null && bmap.getWidth() > 0 && bmap.getHeight() > 0) {
    float w=bmap.getWidth();
    float h=bmap.getHeight();
    float f=mIconSeedSize / Math.min(w,h);
    w=w * f;
    h=h * f;
    bmap=Bitmap.createScaledBitmap(bmap,(int)w,(int)h,true);
    int num_colors_buttons=listColors.getChildCount();
    for (int i=0; i < num_colors_buttons; i++) {
      FilterIconButton b=(FilterIconButton)listColors.getChildAt(i);
      b.setIcon(bmap);
    }
    int num_filters_buttons=listFilters.getChildCount();
    for (int i=0; i < num_filters_buttons; i++) {
      FilterIconButton b=(FilterIconButton)listFilters.getChildAt(i);
      b.setIcon(bmap);
    }
    int num_borders_buttons=listBorders.getChildCount();
    for (int i=0; i < num_borders_buttons; i++) {
      FilterIconButton b=(FilterIconButton)listBorders.getChildAt(i);
      b.setIcon(bmap);
    }
  }
  mLoadBitmapTask=null;
  super.onPostExecute(result);
}
Program: 38472
Project: 38472
Buggy source:
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,boolean highQuality){
  if (mNinePatch == null) {
    return bitmap;
  }
  int w=bitmap.getWidth();
  int h=bitmap.getHeight();
  float scale=scaleFactor * 2.0f;
  Rect bounds=new Rect(0,0,(int)(w / scale),(int)(h / scale));
  Canvas canvas=new Canvas(bitmap);
  canvas.scale(scale,scale);
  mNinePatch.setBounds(bounds);
  mNinePatch.draw(canvas);
  return bitmap;
}

Fixed version (ground truth):
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,boolean highQuality){
  if (mNinePatch == null) {
    return bitmap;
  }
  float scale2=scaleFactor * 2.0f;
  float scale1=1 / scale2;
  return applyHelper(bitmap,scale1,scale2);
}
Program: 38473
Project: 38473
Buggy source:
public ImageFilterFx(Bitmap fxBitmap,String name){
  setFilterType(TYPE_FX);
  mName=name;
  this.fxBitmap=fxBitmap;
}

Fixed version (ground truth):
public ImageFilterFx(Bitmap fxBitmap,String name,int nameResource){
  setFilterType(TYPE_FX);
  mName=name;
  this.fxBitmap=fxBitmap;
  mNameResource=nameResource;
}
Program: 38474
Project: 38474
Buggy source:
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,boolean highQuality){
  Canvas canvas=new Canvas(bitmap);
  Path border=new Path();
  border.moveTo(0,0);
  int w=bitmap.getWidth();
  int h=bitmap.getHeight();
  float bs=mBorderSize / 100.0f * bitmap.getWidth();
  float r=mBorderCornerRadius / 100.0f * bitmap.getWidth();
  border.lineTo(0,h);
  border.lineTo(w,h);
  border.lineTo(w,0);
  border.lineTo(0,0);
  border.addRoundRect(new RectF(bs,bs,w - bs,h - bs),r,r,Path.Direction.CW);
  Paint paint=new Paint();
  paint.setAntiAlias(true);
  paint.setColor(mBorderColor);
  canvas.drawPath(border,paint);
  return bitmap;
}

Fixed version (ground truth):
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,boolean highQuality){
  Canvas canvas=new Canvas(bitmap);
  applyHelper(canvas,bitmap.getWidth(),bitmap.getHeight());
  return bitmap;
}
Program: 38475
Project: 38475
Buggy source:
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,boolean highQuality){
  Rect cropBounds=new Rect(0,0,bitmap.getWidth(),bitmap.getHeight());
  RectF crop=mGeometry.getCropBounds(bitmap);
  if (crop.width() > 0 && crop.height() > 0)   crop.roundOut(cropBounds);
  Bitmap temp=null;
  if (mGeometry.hasSwitchedWidthHeight()) {
    temp=Bitmap.createBitmap(cropBounds.height(),cropBounds.width(),mConfig);
  }
 else {
    temp=Bitmap.createBitmap(cropBounds.width(),cropBounds.height(),mConfig);
  }
  float[] displayCenter={temp.getWidth() / 2f,temp.getHeight() / 2f};
  Matrix m1=mGeometry.buildTotalXform(bitmap.getWidth(),bitmap.getHeight(),displayCenter);
  Canvas canvas=new Canvas(temp);
  Paint paint=new Paint();
  paint.setAntiAlias(true);
  paint.setFilterBitmap(true);
  paint.setDither(true);
  canvas.drawBitmap(bitmap,m1,paint);
  return temp;
}

Fixed version (ground truth):
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,boolean highQuality){
  Rect cropBounds=new Rect(0,0,bitmap.getWidth(),bitmap.getHeight());
  RectF crop=mGeometry.getCropBounds(bitmap);
  if (crop.width() > 0 && crop.height() > 0)   cropBounds=GeometryMath.roundNearest(crop);
  Bitmap temp=null;
  if (mGeometry.hasSwitchedWidthHeight()) {
    temp=Bitmap.createBitmap(cropBounds.height(),cropBounds.width(),mConfig);
  }
 else {
    temp=Bitmap.createBitmap(cropBounds.width(),cropBounds.height(),mConfig);
  }
  float[] displayCenter={temp.getWidth() / 2f,temp.getHeight() / 2f};
  Matrix m1=mGeometry.buildTotalXform(bitmap.getWidth(),bitmap.getHeight(),displayCenter);
  Canvas canvas=new Canvas(temp);
  Paint paint=new Paint();
  paint.setAntiAlias(true);
  paint.setFilterBitmap(true);
  paint.setDither(true);
  canvas.drawBitmap(bitmap,m1,paint);
  return temp;
}
Program: 38476
Project: 38476
Buggy source:
public boolean hasModifications(){
  if (mScaleFactor != 1.0f) {
    return true;
  }
  if (mRotation != 0) {
    return true;
  }
  if (mStraightenRotation != 0) {
    return true;
  }
  Rect cropBounds=new Rect();
  mCropBounds.roundOut(cropBounds);
  Rect photoBounds=new Rect();
  mPhotoBounds.roundOut(photoBounds);
  if (!cropBounds.equals(photoBounds)) {
    return true;
  }
  if (!mFlip.equals(FLIP.NONE)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean hasModifications(){
  if (mScaleFactor != 1.0f) {
    return true;
  }
  if (mRotation != 0) {
    return true;
  }
  if (mStraightenRotation != 0) {
    return true;
  }
  Rect cropBounds=GeometryMath.roundNearest(mCropBounds);
  Rect photoBounds=GeometryMath.roundNearest(mPhotoBounds);
  if (!cropBounds.equals(photoBounds)) {
    return true;
  }
  if (!mFlip.equals(FLIP.NONE)) {
    return true;
  }
  return false;
}
Program: 38477
Project: 38477
Buggy source:
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,boolean highQuality){
  Rect cropBounds=new Rect(0,0,bitmap.getWidth(),bitmap.getHeight());
  RectF crop=mGeometry.getCropBounds(bitmap);
  if (crop.width() > 0 && crop.height() > 0)   crop.roundOut(cropBounds);
  Bitmap temp=null;
  if (mGeometry.hasSwitchedWidthHeight()) {
    temp=Bitmap.createBitmap(cropBounds.height(),cropBounds.width(),mConfig);
  }
 else {
    temp=Bitmap.createBitmap(cropBounds.width(),cropBounds.height(),mConfig);
  }
  float[] displayCenter={temp.getWidth() / 2f,temp.getHeight() / 2f};
  Matrix m1=mGeometry.buildTotalXform(bitmap.getWidth(),bitmap.getHeight(),displayCenter);
  Canvas canvas=new Canvas(temp);
  Paint paint=new Paint();
  paint.setAntiAlias(true);
  paint.setFilterBitmap(true);
  paint.setDither(true);
  canvas.drawBitmap(bitmap,m1,paint);
  return temp;
}

Fixed version (ground truth):
@Override public Bitmap apply(Bitmap bitmap,float scaleFactor,boolean highQuality){
  Rect cropBounds=new Rect(0,0,bitmap.getWidth(),bitmap.getHeight());
  RectF crop=mGeometry.getCropBounds(bitmap);
  if (crop.width() > 0 && crop.height() > 0)   cropBounds=GeometryMath.roundNearest(crop);
  Bitmap temp=null;
  if (mGeometry.hasSwitchedWidthHeight()) {
    temp=Bitmap.createBitmap(cropBounds.height(),cropBounds.width(),mConfig);
  }
 else {
    temp=Bitmap.createBitmap(cropBounds.width(),cropBounds.height(),mConfig);
  }
  float[] displayCenter={temp.getWidth() / 2f,temp.getHeight() / 2f};
  Matrix m1=mGeometry.buildTotalXform(bitmap.getWidth(),bitmap.getHeight(),displayCenter);
  Canvas canvas=new Canvas(temp);
  Paint paint=new Paint();
  paint.setAntiAlias(true);
  paint.setFilterBitmap(true);
  paint.setDither(true);
  canvas.drawBitmap(bitmap,m1,paint);
  return temp;
}
Program: 38478
Project: 38478
Buggy source:
public boolean hasModifications(){
  if (mScaleFactor != 1.0f) {
    return true;
  }
  if (mRotation != 0) {
    return true;
  }
  if (mStraightenRotation != 0) {
    return true;
  }
  Rect cropBounds=new Rect();
  mCropBounds.roundOut(cropBounds);
  Rect photoBounds=new Rect();
  mPhotoBounds.roundOut(photoBounds);
  if (!cropBounds.equals(photoBounds)) {
    return true;
  }
  if (!mFlip.equals(FLIP.NONE)) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
public boolean hasModifications(){
  if (mScaleFactor != 1.0f) {
    return true;
  }
  if (mRotation != 0) {
    return true;
  }
  if (mStraightenRotation != 0) {
    return true;
  }
  Rect cropBounds=GeometryMath.roundNearest(mCropBounds);
  Rect photoBounds=GeometryMath.roundNearest(mPhotoBounds);
  if (!cropBounds.equals(photoBounds)) {
    return true;
  }
  if (!mFlip.equals(FLIP.NONE)) {
    return true;
  }
  return false;
}