Skip to content

Commit

Permalink
Scale crosshair texture by integer-multiples only
Browse files Browse the repository at this point in the history
Avoids possible blurriness.
  • Loading branch information
grorp committed Sep 11, 2023
1 parent 833c324 commit 1a81267
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/client/hud.cpp
Expand Up @@ -783,8 +783,10 @@ void Hud::drawCrosshair()
auto draw_image_crosshair = [this] (video::ITexture *tex) {
core::dimension2di orig_size(tex->getOriginalSize());
core::dimension2di scaled_size(
core::round32(orig_size.Width * m_scale_factor),
core::round32(orig_size.Height * m_scale_factor));
core::round32(orig_size.Width * m_scale_factor / orig_size.Width)
* orig_size.Width,
core::round32(orig_size.Height * m_scale_factor / orig_size.Height)
* orig_size.Height);

core::rect<s32> src_rect(orig_size);
core::position2d pos(m_displaycenter.X - scaled_size.Width / 2,
Expand Down

0 comments on commit 1a81267

Please sign in to comment.