diff --git a/adafruit_gfx/gfx.py b/adafruit_gfx/gfx.py index 745ee56..43aea04 100755 --- a/adafruit_gfx/gfx.py +++ b/adafruit_gfx/gfx.py @@ -25,6 +25,7 @@ __version__ = "0.0.0+auto.0" __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_GFX.git" + # pylint: disable=invalid-name class GFX: # pylint: disable=too-many-instance-attributes @@ -49,6 +50,7 @@ class GFX: :param font: An optional input to augment the default text method with a new font. The input should be a properly formatted dict. """ + # pylint: disable=too-many-arguments def __init__( self, @@ -247,7 +249,6 @@ def fill_triangle(self, x0, y0, x1, y1, x2, y2, *args, **kwargs): x0, x1 = x1, x0 a = 0 b = 0 - y = 0 last = 0 if y0 == y2: a = x0 @@ -276,11 +277,12 @@ def fill_triangle(self, x0, y0, x1, y1, x2, y2, *args, **kwargs): dy12 = 1 sa = 0 sb = 0 - if y1 == y2 or y0 == y1: # pylint: disable=consider-using-in - last = y1 - else: + y = y0 + if y0 == y1: last = y1 - 1 - for y in range(y0, last + 1): + else: + last = y1 + while y <= last: a = x0 + sa // dy01 b = x0 + sb // dy02 sa += dx01 @@ -288,6 +290,7 @@ def fill_triangle(self, x0, y0, x1, y1, x2, y2, *args, **kwargs): if a > b: a, b = b, a self.hline(a, y, b - a + 1, *args, **kwargs) + y += 1 sa = dx12 * (y - y1) sb = dx02 * (y - y0) while y <= y2: @@ -303,7 +306,8 @@ def fill_triangle(self, x0, y0, x1, y1, x2, y2, *args, **kwargs): def round_rect(self, x0, y0, width, height, radius, *args, **kwargs): """Rectangle with rounded corners drawing function. This works like a regular rect though! if radius = 0 - Will draw the outline of a rectangle with rounded corners with (x0,y0) at the top left""" + Will draw the outline of a rectangle with rounded corners with (x0,y0) at the top left + """ # shift to correct for start point location x0 += radius y0 += radius