Program: 31797
Project: 31797
Buggy source:
void drawSpectrogramPlot(Canvas c){
  labelBeginX=getLabelBeginX();
  labelBeginY=getLabelBeginY();
  if (showFreqAlongX) {
    axisFreq.setNCanvasPixel(canvasWidth - labelBeginX);
    axisTime.setNCanvasPixel(labelBeginY);
  }
 else {
    axisTime.setNCanvasPixel(canvasWidth - labelBeginX);
    axisFreq.setNCanvasPixel(labelBeginY);
  }
  fqGridLabel.setDensity(axisFreq.nCanvasPixel * gridDensity / DPRatio);
  tmGridLabel.setDensity(axisTime.nCanvasPixel * gridDensity / DPRatio);
  float halfFreqResolutionShift;
  matrixSpectrogram.reset();
  if (showFreqAlongX) {
    matrixSpectrogram.postScale(axisFreq.zoom * axisFreq.nCanvasPixel / nFreqPoints,axisTime.zoom * axisTime.nCanvasPixel / nTimePoints);
    halfFreqResolutionShift=axisFreq.zoom * axisFreq.nCanvasPixel / nFreqPoints / 2;
    matrixSpectrogram.postTranslate((labelBeginX - axisFreq.shift * axisFreq.zoom * axisFreq.nCanvasPixel + halfFreqResolutionShift),-axisTime.shift * axisTime.zoom * axisTime.nCanvasPixel);
  }
 else {
    matrixSpectrogram.postRotate(-90);
    matrixSpectrogram.postScale(axisTime.zoom * axisTime.nCanvasPixel / nTimePoints,axisFreq.zoom * axisFreq.nCanvasPixel / nFreqPoints);
    halfFreqResolutionShift=axisFreq.zoom * axisFreq.nCanvasPixel / nFreqPoints / 2;
    matrixSpectrogram.postTranslate((labelBeginX - axisTime.shift * axisTime.zoom * axisTime.nCanvasPixel),(1 - axisFreq.shift) * axisFreq.zoom * axisFreq.nCanvasPixel - halfFreqResolutionShift);
  }
  c.save();
  c.concat(matrixSpectrogram);
  if (!isPaused && updateTimeDiff) {
    double timeCurrent=System.currentTimeMillis() / 1000.0;
    pixelTimeCompensate=(float)((timeLastSample - timeCurrent) / (timeInc * timeMultiplier * nTimePoints) * nTimePoints);
    updateTimeDiff=false;
  }
  if (showModeSpectrogram == TimeAxisMode.SHIFT) {
    c.translate(0.0f,pixelTimeCompensate);
  }
  spectrogramBMP.draw(c,axisFreq.mapType);
  c.restore();
  drawFreqCursor(c);
  if (showFreqAlongX) {
    c.drawRect(0,labelBeginY,canvasWidth,canvasHeight,backgroundPaint);
    drawFreqAxis(c,labelBeginX,labelBeginY,showFreqAlongX);
    if (labelBeginX > 0) {
      c.drawRect(0,0,labelBeginX,labelBeginY,backgroundPaint);
      drawTimeAxis(c,labelBeginX,labelBeginY,!showFreqAlongX);
    }
  }
 else {
    c.drawRect(0,0,labelBeginX,labelBeginY,backgroundPaint);
    drawFreqAxis(c,labelBeginX,labelBeginY,showFreqAlongX);
    if (labelBeginY != canvasHeight) {
      c.drawRect(0,labelBeginY,canvasWidth,canvasHeight,backgroundPaint);
      drawTimeAxis(c,labelBeginX,labelBeginY,!showFreqAlongX);
    }
  }
}

Fixed version (ground truth):
void drawSpectrogramPlot(Canvas c){
  labelBeginX=getLabelBeginX();
  labelBeginY=getLabelBeginY();
  if (showFreqAlongX) {
    axisFreq.setNCanvasPixel(canvasWidth - labelBeginX);
    axisTime.setNCanvasPixel(labelBeginY);
  }
 else {
    axisTime.setNCanvasPixel(canvasWidth - labelBeginX);
    axisFreq.setNCanvasPixel(labelBeginY);
  }
  fqGridLabel.setDensity(axisFreq.nCanvasPixel * gridDensity / DPRatio);
  tmGridLabel.setDensity(axisTime.nCanvasPixel * gridDensity / DPRatio);
  float halfFreqResolutionShift;
  if (axisFreq.mapType == ScreenPhysicalMapping.Type.LINEAR) {
    halfFreqResolutionShift=axisFreq.zoom * axisFreq.nCanvasPixel / nFreqPoints / 2;
  }
 else {
    halfFreqResolutionShift=0;
  }
  matrixSpectrogram.reset();
  if (showFreqAlongX) {
    matrixSpectrogram.postScale(axisFreq.zoom * axisFreq.nCanvasPixel / nFreqPoints,axisTime.zoom * axisTime.nCanvasPixel / nTimePoints);
    matrixSpectrogram.postTranslate((labelBeginX - axisFreq.shift * axisFreq.zoom * axisFreq.nCanvasPixel + halfFreqResolutionShift),-axisTime.shift * axisTime.zoom * axisTime.nCanvasPixel);
  }
 else {
    matrixSpectrogram.postRotate(-90);
    matrixSpectrogram.postScale(axisTime.zoom * axisTime.nCanvasPixel / nTimePoints,axisFreq.zoom * axisFreq.nCanvasPixel / nFreqPoints);
    matrixSpectrogram.postTranslate((labelBeginX - axisTime.shift * axisTime.zoom * axisTime.nCanvasPixel),(1 - axisFreq.shift) * axisFreq.zoom * axisFreq.nCanvasPixel - halfFreqResolutionShift);
  }
  c.save();
  c.concat(matrixSpectrogram);
  if (!isPaused && updateTimeDiff) {
    double timeCurrent=System.currentTimeMillis() / 1000.0;
    pixelTimeCompensate=(float)((timeLastSample - timeCurrent) / (timeInc * timeMultiplier * nTimePoints) * nTimePoints);
    updateTimeDiff=false;
  }
  if (showModeSpectrogram == TimeAxisMode.SHIFT) {
    c.translate(0.0f,pixelTimeCompensate);
  }
  spectrogramBMP.draw(c,axisFreq.mapType);
  c.restore();
  drawFreqCursor(c);
  if (showFreqAlongX) {
    c.drawRect(0,labelBeginY,canvasWidth,canvasHeight,backgroundPaint);
    drawFreqAxis(c,labelBeginX,labelBeginY,showFreqAlongX);
    if (labelBeginX > 0) {
      c.drawRect(0,0,labelBeginX,labelBeginY,backgroundPaint);
      drawTimeAxis(c,labelBeginX,labelBeginY,!showFreqAlongX);
    }
  }
 else {
    c.drawRect(0,0,labelBeginX,labelBeginY,backgroundPaint);
    drawFreqAxis(c,labelBeginX,labelBeginY,showFreqAlongX);
    if (labelBeginY != canvasHeight) {
      c.drawRect(0,labelBeginY,canvasWidth,canvasHeight,backgroundPaint);
      drawTimeAxis(c,labelBeginX,labelBeginY,!showFreqAlongX);
    }
  }
}