private int getImageHeightToUse() {
    assert myCurrentImage != null;
    if (myHorizontal) {
      return myCurrentImage.getHeight();
    }

    int sign = myExpand ? 1 : -1;
    int result = myCurrentImage.getHeight() + sign * myAnimationIterationStep;

    if (result <= 0 || result > myImage.getHeight()) {
      return -1;
    }
    return result;
  }
private int getImageHeightToUse()