[client,sdl] use auto for variable declaration

This commit is contained in:
akallabeth 2024-09-12 10:11:05 +02:00
parent 6481993305
commit 773eed8878
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
4 changed files with 13 additions and 13 deletions

View File

@ -105,9 +105,9 @@ SDL_Texture* SdlWidget::render_text(SDL_Renderer* renderer, const std::string& t
dst = _rect;
dst.x += hpadding;
dst.w -= 2 * hpadding;
const float scale = static_cast<float>(dst.h) / static_cast<float>(src.h);
const float sws = static_cast<float>(src.w) * scale;
const float dws = static_cast<float>(dst.w) / scale;
const auto scale = static_cast<float>(dst.h) / static_cast<float>(src.h);
const auto sws = static_cast<float>(src.w) * scale;
const auto dws = static_cast<float>(dst.w) / scale;
if (static_cast<float>(dst.w) > sws)
dst.w = static_cast<int>(sws);
if (static_cast<float>(src.w) > dws)
@ -120,10 +120,10 @@ SDL_Texture* SdlWidget::render_text(SDL_Renderer* renderer, const std::string& t
static int scale(int w, int h)
{
const double dw = static_cast<double>(w);
const double dh = static_cast<double>(h);
const double scale = dh / dw;
const double dr = dh * scale;
const auto dw = static_cast<double>(w);
const auto dh = static_cast<double>(h);
const auto scale = dh / dw;
const auto dr = dh * scale;
return static_cast<int>(dr);
}

View File

@ -177,8 +177,8 @@ static UINT32 sdl_orientaion_to_rdp(SDL_DisplayOrientation orientation)
static Uint32 scale(Uint32 val, float scale)
{
const float dval = static_cast<float>(val);
const float sval = dval / scale;
const auto dval = static_cast<float>(val);
const auto sval = dval / scale;
return static_cast<Uint32>(sval);
}

View File

@ -125,8 +125,8 @@ SDL_Texture* SdlWidget::render_text(SDL_Renderer* renderer, const std::string& t
static float scale(float dw, float dh)
{
const double scale = dh / dw;
const double dr = dh * scale;
const auto scale = dh / dw;
const auto dr = dh * scale;
return dr;
}

View File

@ -178,8 +178,8 @@ static UINT32 sdl_orientaion_to_rdp(SDL_DisplayOrientation orientation)
static Uint32 scale(Uint32 val, float scale)
{
const float dval = static_cast<float>(val);
const float sval = dval / scale;
const auto dval = static_cast<float>(val);
const auto sval = dval / scale;
return static_cast<Uint32>(sval);
}