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

Code before:
}

void CRPBaseRenderer::SetScalingMethod(SCALINGMETHOD method)
{
  m_renderSettings.VideoSettings().SetScalingMethod(method);
}

void CRPBaseRenderer::SetStretchMode(STRETCHMODE stretchMode)
{
  m_renderSettings.VideoSettings().SetRenderStretchMode(stretchMode);
}

void CRPBaseRenderer::SetRenderRotation(unsigned int rotationDegCCW)
{
  m_renderSettings.VideoSettings().SetRenderRotation(rotationDegCCW);
}

void CRPBaseRenderer::ManageRenderArea(const IRenderBuffer& renderBuffer)
{
  // Get texture parameters
  const unsigned int sourceWidth = renderBuffer.GetWidth();
  const unsigned int sourceHeight = renderBuffer.GetHeight();
  const unsigned int sourceRotationDegCCW = renderBuffer.GetRotation();
  const float sourceAspectRatio =
      static_cast<float>(sourceWidth) / static_cast<float>(sourceHeight);
  const SCALINGMETHOD scaleMOde = m_renderSettings.VideoSettings().GetScalingMethod();
  const STRETCHMODE stretchMode = m_renderSettings.VideoSettings().GetRenderStretchMode();
  const bool bhw_filter =
	  CServiceBroker::GetSettingsComponent()->GetSettings()->GetBool(SETTING_VIDEOSCREEN_HW_SCALING_FILTER);
  const unsigned int rotationDegCCW =
      (sourceRotationDegCCW + m_renderSettings.VideoSettings().GetRenderRotation()) % 360;

  // Get screen parameters
  float screenWidth;
  float screenHeight;
  float screenPixelRatio;
  GetScreenDimensions(screenWidth, screenHeight, screenPixelRatio);
  CRect viewRect = m_context.GetViewWindow();
  CRect destRect;
  float pixelRatio = 1.0f;
  float zoomAmount = 1.0f;
  m_sourceRect.x1 = 0.0f;
  m_sourceRect.y1 = 0.0f;
  m_sourceRect.x2 = static_cast<float>(sourceWidth);
  m_sourceRect.y2 = static_cast<float>(sourceHeight);
  if( scaleMOde == SCALINGMETHOD::DISPLAY && stretchMode ==
      STRETCHMODE::Original && bhw_filter ){
    RESOLUTION_INFO m_gameRes=m_context.GetResInfo();
    m_gameRes.Overscan.left = 0;
    m_gameRes.Overscan.top = 0;
    m_gameRes.Overscan.right = sourceWidth;

Review comment (suggestion):
`scaleMode` vs `scaleMOde`, same below where it's used

Code after:
}

void CRPBaseRenderer::SetStretchMode(STRETCHMODE stretchMode)
{
  m_renderSettings.VideoSettings().SetRenderStretchMode(stretchMode);
}

void CRPBaseRenderer::SetRenderRotation(unsigned int rotationDegCCW)
{
  m_renderSettings.VideoSettings().SetRenderRotation(rotationDegCCW);
}

void CRPBaseRenderer::ManageRenderArea(const IRenderBuffer& renderBuffer)
{
  // Get texture parameters
  const unsigned int sourceWidth = renderBuffer.GetWidth();
  const unsigned int sourceHeight = renderBuffer.GetHeight();
  const unsigned int sourceRotationDegCCW = renderBuffer.GetRotation();
  const float sourceAspectRatio =
      static_cast<float>(sourceWidth) / static_cast<float>(sourceHeight);

  const SCALINGMETHOD scaleMode = m_renderSettings.VideoSettings().GetScalingMethod();
  const STRETCHMODE stretchMode = m_renderSettings.VideoSettings().GetRenderStretchMode();
  const unsigned int rotationDegCCW =
      (sourceRotationDegCCW + m_renderSettings.VideoSettings().GetRenderRotation()) % 360;

  // Get screen parameters
  float screenWidth;
  float screenHeight;
  float screenPixelRatio;

  if (scaleMode == SCALINGMETHOD::NEAREST && stretchMode == STRETCHMODE::Original &&
      m_context.DisplayHardwareScalingEnabled())
  {
    screenWidth = sourceWidth;
    screenHeight = sourceHeight;
    screenPixelRatio = 1.0;
  }
  else
  {
    GetScreenDimensions(screenWidth, screenHeight, screenPixelRatio);
  }

  // Entire target rendering area for the video (including black bars)
  const CRect viewRect = m_context.GetViewWindow();

  // Calculate pixel ratio and zoom amount
  float pixelRatio = 1.0f;
  float zoomAmount = 1.0f;
  CRenderUtils::CalculateStretchMode(stretchMode, rotationDegCCW, sourceWidth, sourceHeight,
                                     screenWidth, screenHeight, pixelRatio, zoomAmount);