Bug#1010759: minetest: item count unreadable due to error in rectangle drawing code
Nils Dagsson Moskopp
nils+debian-reportbug at dieweltistgarnichtso.net
Mon May 9 13:01:33 BST 2022
Package: minetest
Version: 5.3.0+repack-2.1+deb11u1
Severity: normal
Tags: patch upstream
X-Debbugs-Cc: nils+debian-reportbug at dieweltistgarnichtso.net
Dear Maintainer,
due to faulty drawing code, the item count has no background rectangle.
To quote the person who discovered the issue & has fixed the rendering:
> The original code was using the wrong overloaded constructor of rect,
> using two points instead of one point and dimension, this patch makes it
> work like it was originally intended.
This often makes an item count very hard to read even with 20/20 vision.
You can verify this easily by holding an item stack with the item string
“vessels:glass_fragments” (included in the default game) with a count of
2 or more: The item count in the lower right corner of the rendered item
stack is almost entirely unreadable, as white digits are rendered on the
mostly-white item background.
I am including a patch to fix this, since upstream only ever focuses on
new releases and people are using older versions of Minetest. The patch
is tested to work with Minetest 5.4.1; please apply it to all versions.
Do not bother upstreaming the patch as upstream is aware of the issue –
see <https://github.com/minetest/minetest/pull/11316> for full context.
-- System Information:
Debian Release: 11.3
APT prefers stable
APT policy: (900, 'stable'), (500, 'oldoldstable')
Architecture: i386 (i686)
Kernel: Linux 5.10.0-10-686 (SMP w/2 CPU threads)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
Versions of packages minetest depends on:
ii libc6 2.31-13+deb11u3
ii libcurl3-gnutls 7.74.0-1.3+deb11u1
ii libfreetype6 2.10.4+dfsg-1
ii libgcc-s1 10.2.1-6
ii libgmp10 2:6.2.1+dfsg-1+deb11u1
ii libirrlicht1.8 1.8.4+dfsg1-1.1
ii libjsoncpp24 1.9.4-4
ii libleveldb1d 1.22-3
ii libluajit-5.1-2 2.1.0~beta3+dfsg-5.3
ii libncursesw6 6.2+20201114-2
ii libopenal1 1:1.19.1-2
ii libpq5 13.5-0+deb11u1
ii libspatialindex6 1.9.3-2
ii libsqlite3-0 3.34.1-3
ii libstdc++6 10.2.1-6
ii libtinfo6 6.2+20201114-2
ii libvorbisfile3 1.3.7-1
ii libx11-6 2:1.7.2-1
ii minetest-data 5.3.0+repack-2.1+deb11u1
ii zlib1g 1:1.2.11.dfsg-2
minetest recommends no packages.
Versions of packages minetest suggests:
pn minetest-mod-moreblocks <none>
pn minetest-mod-moreores <none>
pn minetest-mod-pipeworks <none>
pn minetest-server <none>
pn minetestmapper <none>
-- no debconf information
-------------- next part --------------
>From d8394f4d509101df1927f2ed91f5f750faebf595 Mon Sep 17 00:00:00 2001
From: Kezi <keziolio123 at gmail.com>
Date: Sat, 5 Jun 2021 00:03:56 +0200
Subject: [PATCH] Draw item count background rectangle in inventory
The original code was using the wrong overloaded constructor of rect,
using two points instead of one point and dimension, this patch makes it
work like it was originally intended.
See <https://github.com/minetest/minetest/pull/11316> for context.
---
src/client/hud.cpp | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/client/hud.cpp b/src/client/hud.cpp
index 46736b325..99a1c03fb 100644
--- a/src/client/hud.cpp
+++ b/src/client/hud.cpp
@@ -1098,15 +1098,21 @@ void drawItemStack(
v2u32 dim = font->getDimension(utf8_to_wide(text).c_str());
v2s32 sdim(dim.X, dim.Y);
- core::rect<s32> rect2(
- /*rect.UpperLeftCorner,
- core::dimension2d<u32>(rect.getWidth(), 15)*/
- rect.LowerRightCorner - sdim,
- sdim
+ const s32 horizontal_padding = 3; //px
+ core::position2d<s32> offset(-5,-2);
+
+ core::rect<s32> background_rect(
+ rect.LowerRightCorner - sdim + core::position2d<s32>(-horizontal_padding,0) + offset,
+ rect.LowerRightCorner + core::position2d<s32>(horizontal_padding,0) + offset
);
video::SColor bgcolor(128, 0, 0, 0);
- driver->draw2DRectangle(bgcolor, rect2, clip);
+ driver->draw2DRectangle(bgcolor, background_rect, clip);
+
+ core::rect<s32> rect2(
+ rect.LowerRightCorner - sdim + offset,
+ rect.LowerRightCorner + offset
+ );
video::SColor color(255, 255, 255, 255);
font->draw(text.c_str(), rect2, color, false, false, clip);
--
2.30.2
More information about the Pkg-games-devel
mailing list