Repository: xbmc/xbmc
File: xbmc/cores/RetroPlayer/rendering/RenderUtils.cpp (C++)

Code before:
          break;
      }
      zoomAmount = 1.0f;

      break;
    }
    case STRETCHMODE::Fullscreen:
    {
      // Stretch to the limits of the screen
      pixelRatio = (screenWidth / screenHeight) / sourceFrameRatio;
      zoomAmount = 1.0f;

      break;
    }
    case STRETCHMODE::Integer:
    {
      switch (rotationDegCCW)
      {
        case 90:
        case 270:
        {
          pixelRatio = 1.0f / (pixelRatio * sourceFrameRatio * sourceFrameRatio);

          if (screenWidth / (sourceFrameRatio * pixelRatio) > screenHeight)
          {
            int zoomFactor = (int)screenHeight / sourceWidth;
            zoomAmount = (zoomFactor * sourceWidth) / screenHeight;
          }
          else
          {
            int zoomFactor = (int)screenWidth / (sourceHeight * pixelRatio);
            zoomAmount = (zoomFactor * sourceHeight * pixelRatio) / screenWidth;
          }

          break;
        }
        default:
          // Keep original pixel ratio

          if (screenWidth / (sourceFrameRatio * pixelRatio) > screenHeight)
          {
            int zoomFactor = (int)screenHeight / sourceHeight;
            zoomAmount = (zoomFactor * sourceHeight) / screenHeight;
          }
          else
          {
            int zoomFactor = (int)screenWidth / (sourceWidth * pixelRatio);
            zoomAmount = (zoomFactor * sourceWidth * pixelRatio) / screenWidth;
          }

          break;

Review comment (suggestion):
Please use c++ casts, e.g. static_cast<int>(screenHeight / sourceWidth)

Also, slap a `const` on the var, no need for it to be mutable.

Code after:
          break;
      }
      zoomAmount = 1.0f;

      break;
    }
    case STRETCHMODE::Fullscreen:
    {
      // Stretch to the limits of the screen
      pixelRatio = (screenWidth / screenHeight) / sourceFrameRatio;
      zoomAmount = 1.0f;

      break;
    }
    case STRETCHMODE::Integer:
    {
      switch (rotationDegCCW)
      {
        case 90:
        case 270:
        {
          pixelRatio = 1.0f / (pixelRatio * sourceFrameRatio * sourceFrameRatio);

          if (screenWidth / (sourceFrameRatio * pixelRatio) > screenHeight)
          {
            const int zoomFactor = static_cast<int>(screenHeight / sourceWidth);
            zoomAmount = (zoomFactor * sourceWidth) / screenHeight;
          }
          else
          {
            const int zoomFactor = static_cast<int>(screenWidth / (sourceHeight * pixelRatio));
            zoomAmount = (zoomFactor * sourceHeight * pixelRatio) / screenWidth;
          }

          break;
        }
        default:
          // Keep original pixel ratio

          if (screenWidth / (sourceFrameRatio * pixelRatio) > screenHeight)
          {
            const int zoomFactor = static_cast<int>(screenHeight / sourceHeight);
            zoomAmount = (zoomFactor * sourceHeight) / screenHeight;
          }
          else
          {
            const int zoomFactor = static_cast<int>(screenWidth / (sourceWidth * pixelRatio));
            zoomAmount = (zoomFactor * sourceWidth * pixelRatio) / screenWidth;
          }

          break;