From 6a2c5934f73ec5d289dc8d0fb208ff5004b55aa0 Mon Sep 17 00:00:00 2001
From: Ryan Oldenburg <ryan@guzba.com>
Date: Tue, 9 Aug 2022 13:50:17 -0500
Subject: [PATCH] fix smooth draw fuzz

---
 pixie.nimble         | 2 +-
 src/pixie/images.nim | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/pixie.nimble b/pixie.nimble
index 09e00a6..ff8590b 100644
--- a/pixie.nimble
+++ b/pixie.nimble
@@ -1,4 +1,4 @@
-version     = "5.0.0"
+version     = "5.0.1"
 author      = "Andre von Houck and Ryan Oldenburg"
 description = "Full-featured 2d graphics library for Nim."
 license     = "MIT"
diff --git a/src/pixie/images.nim b/src/pixie/images.nim
index 6b0f77e..c4ec9cf 100644
--- a/src/pixie/images.nim
+++ b/src/pixie/images.nim
@@ -582,6 +582,9 @@ proc drawSmooth(a, b: Image, transform: Mat3, blendMode: BlendMode) =
       xStart = clamp(xMin.floor.int, 0, a.width)
       xEnd = clamp(xMax.ceil.int, 0, a.width)
 
+    if xEnd - xStart == 0:
+      continue
+
     var srcPos = p + dx * xStart.float32 + dy * y.float32
     srcPos = vec2(srcPos.x - h, srcPos.y - h)
     for x in xStart ..< xEnd: