Program: 58504
Project: 58504
Buggy source:
private void renderMatrixSelection(GL gl){
  float fHeight;
  float fWidth;
  fHeight=viewFrustum.getHeight();
  fWidth=viewFrustum.getWidth();
  if (fWidth > fHeight)   fWidth=fHeight;
  int iAddTextures=1;
  if (bAllowMatrixZoom)   if (MOUSEOVER_X_AXIS >= 0 && MOUSEOVER_Y_AXIS > 0)   iAddTextures=5;
  float fStepY=fHeight / (float)(NR_TEXTURESY + iAddTextures);
  float fStepX=fWidth / (float)(NR_TEXTURESX + iAddTextures);
  float fSpacerX=fStepX / (float)(NR_TEXTURESY + iAddTextures);
  float fSpacerY=fStepY / (float)(NR_TEXTURESX + iAddTextures);
  float fyOffset=fHeight;
  float fxOffset=fSpacerX;
  int iZoomfactor=1;
  float iMOVERZOOMX=0;
  float iMOVERZOOMY=0;
  if ((MOUSEOVER_X_AXIS >= 0 && MOUSEOVER_Y_AXIS >= 0) && (bAllowMatrixZoom)) {
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS + 1))     iMOVERZOOMX=0.5f;
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS + 1))     iMOVERZOOMY=0.5f;
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS))     iMOVERZOOMX=2.0f;
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS))     iMOVERZOOMY=2.0f;
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS - 1))     iMOVERZOOMX=3.5f;
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS - 1))     iMOVERZOOMY=3.5f;
    if ((MOUSEOVER_X_AXIS < SELECTED_X_AXIS - 1))     iMOVERZOOMX=4;
    if ((MOUSEOVER_Y_AXIS < SELECTED_Y_AXIS - 1))     iMOVERZOOMY=4;
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS) && (MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS + 1)) {
      iZoomfactor=2;
      iMOVERZOOMX=1.5f;
      iMOVERZOOMY=1;
    }
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS) && (MOUSEOVER_X_AXIS == SELECTED_X_AXIS + 1)) {
      iZoomfactor=2;
      iMOVERZOOMX=0f;
      iMOVERZOOMY=2.5f;
    }
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS) && (MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS - 1)) {
      iZoomfactor=2;
      iMOVERZOOMX=1.5f;
      iMOVERZOOMY=4;
    }
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS) && (MOUSEOVER_X_AXIS == SELECTED_X_AXIS - 1)) {
      iZoomfactor=2;
      iMOVERZOOMX=3f;
      iMOVERZOOMY=2.5f;
    }
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS) && (MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS)) {
      iMOVERZOOMX=1;
      iMOVERZOOMY=3;
      if (MOUSEOVER_X_AXIS == 0)       iMOVERZOOMX=0;
      iZoomfactor=3;
    }
  }
  fyOffset-=(fStepY + fSpacerY) * (float)(SELECTED_Y_AXIS + 1 + iMOVERZOOMY);
  fxOffset+=(fStepX + fSpacerX) * (float)(SELECTED_X_AXIS + iMOVERZOOMX);
  float fEdge=0.01f;
  float z=1f;
  float[] fArMappingColor=GeneralRenderStyle.SELECTED_COLOR;
  DrawRectangularSelection(gl,fxOffset - fEdge,fyOffset - fEdge,z,fStepX * iZoomfactor + 2 * fEdge,fStepY * iZoomfactor + 2 * fEdge,fArMappingColor);
  if ((MOUSEOVER_X_AXIS < 0 && MOUSEOVER_Y_AXIS < 0))   return;
  fyOffset=fHeight;
  fxOffset=fSpacerX;
  if (bAllowMatrixZoom) {
    iMOVERZOOMX=1;
    iMOVERZOOMY=3;
    if (MOUSEOVER_X_AXIS == 0)     iMOVERZOOMX=0;
    iZoomfactor=3;
  }
  fyOffset-=(fStepY + fSpacerY) * (float)(MOUSEOVER_Y_AXIS + 1 + iMOVERZOOMY);
  fxOffset+=(fStepX + fSpacerX) * (float)(MOUSEOVER_X_AXIS + iMOVERZOOMX);
  fArMappingColor=GeneralRenderStyle.MOUSE_OVER_COLOR;
  DrawRectangularSelection(gl,fxOffset - fEdge,fyOffset - fEdge,z,fStepX * iZoomfactor + 2 * fEdge,fStepY * iZoomfactor + 2 * fEdge,fArMappingColor);
}

Fixed version (ground truth):
private void renderMatrixSelection(GL gl){
  float fHeight;
  float fWidth;
  fHeight=viewFrustum.getHeight();
  fWidth=viewFrustum.getWidth();
  if (fWidth > fHeight)   fWidth=fHeight;
  int iAddTextures=1;
  if (bAllowMatrixZoom)   if (MOUSEOVER_X_AXIS >= 0 && MOUSEOVER_Y_AXIS > 0)   iAddTextures=5;
  float fStepY=fHeight / (float)(NR_TEXTURESY + iAddTextures);
  float fStepX=fWidth / (float)(NR_TEXTURESX + iAddTextures);
  float fSpacerX=fStepX / (float)(NR_TEXTURESY + iAddTextures);
  float fSpacerY=fStepY / (float)(NR_TEXTURESX + iAddTextures);
  float fyOffset=fHeight;
  float fxOffset=fSpacerX;
  int iZoomfactor=1;
  float iMOVERZOOMX=0;
  float iMOVERZOOMY=0;
  if ((MOUSEOVER_X_AXIS >= 0 && MOUSEOVER_Y_AXIS >= 0) && (bAllowMatrixZoom)) {
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS + 1))     iMOVERZOOMX=0.5f;
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS + 1))     iMOVERZOOMY=0.5f;
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS))     iMOVERZOOMX=2.0f;
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS))     iMOVERZOOMY=2.0f;
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS - 1))     iMOVERZOOMX=3.5f;
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS - 1))     iMOVERZOOMY=3.5f;
    if ((MOUSEOVER_X_AXIS < SELECTED_X_AXIS - 1))     iMOVERZOOMX=4;
    if ((MOUSEOVER_Y_AXIS < SELECTED_Y_AXIS - 1))     iMOVERZOOMY=4;
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS) && (MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS + 1)) {
      iZoomfactor=2;
      iMOVERZOOMX=1.5f;
      iMOVERZOOMY=1;
    }
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS) && (MOUSEOVER_X_AXIS == SELECTED_X_AXIS + 1)) {
      iZoomfactor=2;
      iMOVERZOOMX=0f;
      iMOVERZOOMY=2.5f;
    }
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS) && (MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS - 1)) {
      iZoomfactor=2;
      iMOVERZOOMX=1.5f;
      iMOVERZOOMY=4;
    }
    if ((MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS) && (MOUSEOVER_X_AXIS == SELECTED_X_AXIS - 1)) {
      iZoomfactor=2;
      iMOVERZOOMX=3f;
      iMOVERZOOMY=2.5f;
    }
    if (MOUSEOVER_X_AXIS == 0)     iMOVERZOOMX-=1;
    if ((MOUSEOVER_X_AXIS == SELECTED_X_AXIS) && (MOUSEOVER_Y_AXIS == SELECTED_Y_AXIS)) {
      iMOVERZOOMX=1;
      iMOVERZOOMY=3;
      if (MOUSEOVER_X_AXIS == 0)       iMOVERZOOMX=0;
      iZoomfactor=3;
    }
  }
  fyOffset-=(fStepY + fSpacerY) * (float)(SELECTED_Y_AXIS + 1 + iMOVERZOOMY);
  fxOffset+=(fStepX + fSpacerX) * (float)(SELECTED_X_AXIS + iMOVERZOOMX);
  float fEdge=0.01f;
  float z=1f;
  float[] fArMappingColor=GeneralRenderStyle.SELECTED_COLOR;
  DrawRectangularSelection(gl,fxOffset - fEdge,fyOffset - fEdge,z,fStepX * iZoomfactor + 2 * fEdge,fStepY * iZoomfactor + 2 * fEdge,fArMappingColor);
  if ((MOUSEOVER_X_AXIS < 0 && MOUSEOVER_Y_AXIS < 0))   return;
  fyOffset=fHeight;
  fxOffset=fSpacerX;
  if (bAllowMatrixZoom) {
    iMOVERZOOMX=1;
    iMOVERZOOMY=3;
    if (MOUSEOVER_X_AXIS == 0)     iMOVERZOOMX=0;
    iZoomfactor=3;
  }
  fyOffset-=(fStepY + fSpacerY) * (float)(MOUSEOVER_Y_AXIS + 1 + iMOVERZOOMY);
  fxOffset+=(fStepX + fSpacerX) * (float)(MOUSEOVER_X_AXIS + iMOVERZOOMX);
  fArMappingColor=GeneralRenderStyle.MOUSE_OVER_COLOR;
  DrawRectangularSelection(gl,fxOffset - fEdge,fyOffset - fEdge,z,fStepX * iZoomfactor + 2 * fEdge,fStepY * iZoomfactor + 2 * fEdge,fArMappingColor);
}