From 4d9d1f309cc4b584e812385e7a404956e35dcc0d Mon Sep 17 00:00:00 2001 From: Gaspar Capello Date: Wed, 21 Apr 2021 09:24:59 -0300 Subject: [PATCH] Fix regression: line tool draws extra pixels on the canvas edge How the bug could be reproduced (before this fix): - Select the line tool. - Click and hold down the left mouse button on the canvas to put the first line point. - Drag the mouse outside the canvas and move it around (like trying to put the second point of the line outside the canvas). --- src/app/tools/point_shape.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/tools/point_shape.cpp b/src/app/tools/point_shape.cpp index ce55e7e4a..12b727a6d 100644 --- a/src/app/tools/point_shape.cpp +++ b/src/app/tools/point_shape.cpp @@ -1,5 +1,5 @@ // Aseprite -// Copyright (C) 2020 Igara Studio S.A. +// Copyright (C) 2020-2021 Igara Studio S.A. // Copyright (C) 2001-2015 David Capello // // This program is distributed under the terms of @@ -81,11 +81,11 @@ void PointShape::doInkHline(int x1, int y, int x2, ToolLoop* loop) } // Clipped in X axis else { - x1 = base::clamp(x1, 0, dstw-1); - x2 = base::clamp(x2, 0, dstw-1); - if (x2-x1+1 < 1) + if (x2 < 0 || x1 >= dstw || x2-x1+1 < 1) return; + x1 = base::clamp(x1, 0, dstw-1); + x2 = base::clamp(x2, 0, dstw-1); ink->inkHline(x1, y, x2, loop); } }