void Renderer::SetWindowSize(int width, int height) { if (width < 1) width = 1; if (height < 1) height = 1; // Scale the window size by the EFB scale. CalculateTargetScale(width, height, &width, &height); Host_RequestRenderWindowSize(width, height); }
void Renderer::SetWindowSize(u32 width, u32 height) { width = std::max(width, 16u); height = std::max(height, 16u); // Scale the window size by the EFB scale. std::tie(width, height) = CalculateTargetScale(width, height); float scaled_width, scaled_height; std::tie(scaled_width, scaled_height) = ScaleToDisplayAspectRatio(width, height); if (g_ActiveConfig.bCrop) { // Force 4:3 or 16:9 by cropping the image. float current_aspect = scaled_width / scaled_height; float expected_aspect = (g_ActiveConfig.iAspectRatio == ASPECT_ANALOG_WIDE || (g_ActiveConfig.iAspectRatio != ASPECT_ANALOG && m_aspect_wide)) ? (16.0f / 9.0f) : (4.0f / 3.0f); if (current_aspect > expected_aspect) { // keep height, crop width scaled_width = scaled_height * expected_aspect; } else { // keep width, crop height scaled_height = scaled_width / expected_aspect; } } width = static_cast<int>(std::ceil(scaled_width)); height = static_cast<int>(std::ceil(scaled_height)); // UpdateDrawRectangle() makes sure that the rendered image is divisible by four for video // encoders, so do that here too to match it width -= width % 4; height -= height % 4; Host_RequestRenderWindowSize(width, height); }