Cleanup: change POD casts from static_cast to functional/ctor casts, for consistency (#2648)

Co-authored-by: Raziel Alphadios <raziely@gmail.com>
This commit is contained in:
Raziel Alphadios
2021-11-01 00:54:10 +02:00
committed by GitHub
parent b2d13fc3b8
commit 094d34194c
4 changed files with 16 additions and 16 deletions

View File

@@ -253,12 +253,12 @@ namespace
void drawToScreen(bgfx::ViewId &view, AppState const &state)
{
float invScreenScaleX = 1.0f / static_cast<float>(state.m_width);
float invScreenScaleY = 1.0f / static_cast<float>(state.m_height);
float invScreenScaleX = 1.0f / float(state.m_width);
float invScreenScaleY = 1.0f / float(state.m_height);
float scaleX = m_widgetWidth * invScreenScaleX;
float scaleY = m_widgetHeight * invScreenScaleY;
float offsetX = -bx::min(bx::max(m_position.x - m_widgetWidth * 0.5f, -3.0f), static_cast<float>(state.m_width - m_widgetWidth + 3) ) * invScreenScaleX;
float offsetY = -bx::min(bx::max(m_position.y - m_widgetHeight * 0.5f, -3.0f), static_cast<float>(state.m_height - m_widgetHeight + 3) ) * invScreenScaleY;
float offsetX = -bx::min(bx::max(m_position.x - m_widgetWidth * 0.5f, -3.0f), float(state.m_width - m_widgetWidth + 3) ) * invScreenScaleX;
float offsetY = -bx::min(bx::max(m_position.y - m_widgetHeight * 0.5f, -3.0f), float(state.m_height - m_widgetHeight + 3) ) * invScreenScaleY;
bgfx::setState(0 | BGFX_STATE_WRITE_RGB | BGFX_STATE_WRITE_A | BGFX_STATE_DEPTH_TEST_ALWAYS | BGFX_STATE_BLEND_ALPHA);
bgfx::setTexture(0, state.s_color, m_widgetTexture);
@@ -278,12 +278,12 @@ namespace
}
const float verticalPos = caps->originBottomLeft ? state.m_height - m_position.y : m_position.y;
const float invMagScaleX = 1.0f / static_cast<float>(m_content.m_width);
const float invMagScaleY = 1.0f / static_cast<float>(m_content.m_height);
const float invMagScaleX = 1.0f / float(m_content.m_width);
const float invMagScaleY = 1.0f / float(m_content.m_height);
const float scaleX = state.m_width * invMagScaleX;
const float scaleY = state.m_height * invMagScaleY;
const float offsetX = bx::min(bx::max(m_position.x - m_content.m_width * 0.5f, 0.0f), static_cast<float>(state.m_width - m_content.m_width) ) * scaleX / state.m_width;
const float offsetY = bx::min(bx::max(verticalPos - m_content.m_height * 0.5f, 0.0f), static_cast<float>(state.m_height - m_content.m_height) ) * scaleY / state.m_height;
const float offsetX = bx::min(bx::max(m_position.x - m_content.m_width * 0.5f, 0.0f), float(state.m_width - m_content.m_width) ) * scaleX / state.m_width;
const float offsetY = bx::min(bx::max(verticalPos - m_content.m_height * 0.5f, 0.0f), float(state.m_height - m_content.m_height) ) * scaleY / state.m_height;
bgfx::setViewName(view, "magnifier");
bgfx::setViewRect(view, 0, 0, uint16_t(m_content.m_width), uint16_t(m_content.m_height) );

View File

@@ -333,14 +333,14 @@ bool Fsr::supports16BitPrecision() const
void Fsr::updateUniforms()
{
const float srcWidth = static_cast<float>(m_resources->m_width) / m_config.m_superSamplingFactor;
const float srcHeight = static_cast<float>(m_resources->m_height) / m_config.m_superSamplingFactor;
const float srcWidth = float(m_resources->m_width) / m_config.m_superSamplingFactor;
const float srcHeight = float(m_resources->m_height) / m_config.m_superSamplingFactor;
m_resources->m_uniforms.ViewportSizeRcasAttenuation.x = srcWidth;
m_resources->m_uniforms.ViewportSizeRcasAttenuation.y = srcHeight;
m_resources->m_uniforms.ViewportSizeRcasAttenuation.z = m_config.m_rcasAttenuation;
m_resources->m_uniforms.SrcSize.x = static_cast<float>(m_resources->m_width);
m_resources->m_uniforms.SrcSize.y = static_cast<float>(m_resources->m_height);
m_resources->m_uniforms.DstSize.x = static_cast<float>(m_resources->m_width);
m_resources->m_uniforms.DstSize.y = static_cast<float>(m_resources->m_height);
m_resources->m_uniforms.SrcSize.x = float(m_resources->m_width);
m_resources->m_uniforms.SrcSize.y = float(m_resources->m_height);
m_resources->m_uniforms.DstSize.x = float(m_resources->m_width);
m_resources->m_uniforms.DstSize.y = float(m_resources->m_height);
}