mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/3] 2d-primitives: fix missing pixel in gu_draw_line()
@ 2017-10-12 17:52 Nikita Yushchenko
  2017-10-12 17:52 ` [PATCH 2/3] fbtest: add solid pattern Nikita Yushchenko
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Nikita Yushchenko @ 2017-10-12 17:52 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: Andrey Smirnov, barebox, Chris Healy, Nikita Yushchenko

When drawing line from (x1, y1) to (x2, y2), pixel at (x2, y2) should
be included.

Signed-off-by: Nikita Yushchenko <nikita.yoush@cogentembedded.com>
---
 lib/gui/2d-primitives.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/gui/2d-primitives.c b/lib/gui/2d-primitives.c
index 0f29b32ba..89acc092d 100644
--- a/lib/gui/2d-primitives.c
+++ b/lib/gui/2d-primitives.c
@@ -61,7 +61,7 @@ static void draw_simple_line(struct screen *sc,
 		swap(y1, y2);
 	}
 
-	for (x = x1; x < x2 - 1; x++) {
+	for (x = x1; x <= x2; x++) {
 		if (!dash ||
 		    (++pixel % (2 * dash)) < dash)
 			illuminate(sc->info,
@@ -137,7 +137,7 @@ void gu_draw_line(struct screen *sc,
 	j   = y1;
 	eps = dy - dx;
 
-	for (i = x1; i <= x2 - 1; i++) {
+	for (i = x1; i <= x2; i++) {
 		if (!dash ||
 		    (++pixel % (2 * dash)) > dash) {
 			illuminate(sc->info,
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-16  7:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-12 17:52 [PATCH 1/3] 2d-primitives: fix missing pixel in gu_draw_line() Nikita Yushchenko
2017-10-12 17:52 ` [PATCH 2/3] fbtest: add solid pattern Nikita Yushchenko
2017-10-12 17:52 ` [PATCH 3/3] fbtest: add gradients pattern Nikita Yushchenko
2017-10-13 13:20   ` Sam Ravnborg
2017-10-16  7:20     ` Sascha Hauer
2017-10-12 18:30 ` [PATCH 1/3] 2d-primitives: fix missing pixel in gu_draw_line() Chris Healy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox