X-Git-Url: https://git.ayoreis.com/hackapet/Adafruit_Blinka_Displayio.git/blobdiff_plain/b971dbe24e9c469e1929573909a6db63941b5d32..1ea1487b1fc1c23b989e334f15b3c65fc837c28c:/displayio/_display.py diff --git a/displayio/_display.py b/displayio/_display.py index 5ed157b..eacb654 100644 --- a/displayio/_display.py +++ b/displayio/_display.py @@ -298,14 +298,10 @@ class Display: else: width, height = self._width, self._height - if rectangle.x1 < 0: - rectangle.x1 = 0 - if rectangle.y1 < 0: - rectangle.y1 = 0 - if rectangle.x2 > width: - rectangle.x2 = width - if rectangle.y2 > height: - rectangle.y2 = height + rectangle.x1 = max(rectangle.x1, 0) + rectangle.y1 = max(rectangle.y1, 0) + rectangle.x2 = min(rectangle.x2, width) + rectangle.y2 = min(rectangle.y2, height) return rectangle