From c0e303632e7811555643d664012d9568801c0ae1 Mon Sep 17 00:00:00 2001 From: Norman Feske Date: Thu, 15 Sep 2022 16:35:22 +0200 Subject: [PATCH] gems: fix clipping in polygon_gfx/line_painter.h This clipping check happened to wrongly test the surface's clipping area instead of the by 1x1 pixel reduced 'clip' rectangle. --- repos/gems/include/polygon_gfx/line_painter.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/repos/gems/include/polygon_gfx/line_painter.h b/repos/gems/include/polygon_gfx/line_painter.h index 65df7f621a..fed44197a3 100644 --- a/repos/gems/include/polygon_gfx/line_painter.h +++ b/repos/gems/include/polygon_gfx/line_painter.h @@ -128,9 +128,12 @@ struct Line_painter */ Rect const clip(surface.clip().p1(), surface.clip().p2() + Point(-1, -1)); + if (!clip.valid()) + return; + /* both points must reside within clipping area */ - if (!surface.clip().contains(Point(x1.integer(), y1.integer())) || - !surface.clip().contains(Point(x2.integer(), y2.integer()))) + if (!clip.contains(Point(x1.integer(), y1.integer())) || + !clip.contains(Point(x2.integer(), y2.integer()))) return; long const dx_f = x2.value - x1.value,