← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1696702-fuzzy-building-plots into lp:widelands

 

GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1696702-fuzzy-building-plots into lp:widelands.

Commit message:
Force integer precision for overlays. This fixes fuzzy overlay images when the player hits Ctrl+0 to reset the zoom.

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1696702 in widelands: "Zoom reset can end up with fuzzy building plot icons"
  https://bugs.launchpad.net/widelands/+bug/1696702

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1696702-fuzzy-building-plots/+merge/343070

Works fine on my Linux. Let's wait for AppVeyor and test on Windows to see if the bug is indeed gone.
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1696702-fuzzy-building-plots into lp:widelands.
=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc	2018-04-07 16:59:00 +0000
+++ src/wui/interactive_player.cc	2018-04-12 08:09:00 +0000
@@ -309,8 +309,9 @@
 
 		const float scale = 1.f / given_map_view->view().zoom;
 		const auto blit_overlay = [dst, f, scale](const Image* pic, const Vector2i& hotspot) {
-			dst->blitrect_scale(Rectf(f->rendertarget_pixel - hotspot.cast<float>() * scale,
-			                          pic->width() * scale, pic->height() * scale),
+			const Recti pixel_perfect_rect = Rectf(f->rendertarget_pixel - hotspot.cast<float>() * scale,
+														pic->width() * scale, pic->height() * scale).cast<int>();
+			dst->blitrect_scale(pixel_perfect_rect.cast<float>(),
 			                    pic, Recti(0, 0, pic->width(), pic->height()), 1.f,
 			                    BlendMode::UseAlpha);
 		};


Follow ups