From 34d96df3233e0be5492ce7f221deb8ca06beae9a Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Thu, 23 Dec 2021 13:17:22 -0600 Subject: [PATCH] 3.1.2 bugfix --- pixie.nimble | 2 +- src/pixie/paths.nim | 14 +++++++++++-- tests/paths/path0pxCover.png | Bin 0 -> 313 bytes tests/paths/path1pxCover.png | Bin 0 -> 315 bytes tests/paths/pathStroke1Big.png | Bin 0 -> 1414 bytes tests/paths/pathStroke1BigMask.png | Bin 0 -> 432 bytes tests/test_paths.nim | 31 +++++++++++++++++++++++++++++ 7 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 tests/paths/path0pxCover.png create mode 100644 tests/paths/path1pxCover.png create mode 100644 tests/paths/pathStroke1Big.png create mode 100644 tests/paths/pathStroke1BigMask.png diff --git a/pixie.nimble b/pixie.nimble index 85a8301..0da9a12 100644 --- a/pixie.nimble +++ b/pixie.nimble @@ -1,4 +1,4 @@ -version = "3.1.1" +version = "3.1.2" author = "Andre von Houck and Ryan Oldenburg" description = "Full-featured 2d graphics library for Nim." license = "MIT" diff --git a/src/pixie/paths.nim b/src/pixie/paths.nim index 1e37fbe..34b745b 100644 --- a/src/pixie/paths.nim +++ b/src/pixie/paths.nim @@ -1601,11 +1601,16 @@ proc fillShapes( bounds = computeBounds(segments).snapToPixels() startX = max(0, bounds.x.int) startY = max(0, bounds.y.int) + pathWidth = + if startX < image.width: + min(bounds.w.int, image.width - startX) + else: + 0 pathHeight = min(image.height, (bounds.y + bounds.h).int) partitioning = partitionSegments(segments, startY, pathHeight - startY) var - coverages = newSeq[uint8](bounds.w.int) + coverages = newSeq[uint8](pathWidth) hits = newSeq[(float32, int16)](partitioning.maxEntryCount) numHits: int aa: bool @@ -1659,11 +1664,16 @@ proc fillShapes( bounds = computeBounds(segments).snapToPixels() startX = max(0, bounds.x.int) startY = max(0, bounds.y.int) + pathWidth = + if startX < mask.width: + min(bounds.w.int, mask.width - startX) + else: + 0 pathHeight = min(mask.height, (bounds.y + bounds.h).int) partitioning = partitionSegments(segments, startY, pathHeight) var - coverages = newSeq[uint8](bounds.w.int) + coverages = newSeq[uint8](pathWidth) hits = newSeq[(float32, int16)](partitioning.maxEntryCount) numHits: int aa: bool diff --git a/tests/paths/path0pxCover.png b/tests/paths/path0pxCover.png new file mode 100644 index 0000000000000000000000000000000000000000..f95358daba82623edcbd30e72ddb8a8ddf5756c1 GIT binary patch literal 313 zcmeAS@N?(olHy`uVBq!ia0vp^DImFVdQ I&MBb@0K}+bZ2$lO literal 0 HcmV?d00001 diff --git a/tests/paths/path1pxCover.png b/tests/paths/path1pxCover.png new file mode 100644 index 0000000000000000000000000000000000000000..49a575c86ea361952402436baec21d36b33228ca GIT binary patch literal 315 zcmeAS@N?(olHy`uVBq!ia0vp^DImWhCi2&Qh3KQY00iG)zHM~|Xm+mWHf_+)Z_?t9mHJe`Ir$0kTPC*fmo-kiBNN`YBh TJ6F#e7$^*$u6{1-oD!MDfQS`q4nZ?xrj#Fl*o-aAi8Stb6U>N7cgQ!%fl>+zL?&og@#QoroMl! z-8A+EFYqeL4)K;36%5JcPm@|As(L+B`*JdWYFzb~1j9XDA39b9nh9P8vq4B|x|~I< zWf#{xcDm<0N1#cVs-f2LK?#G1K5<&2yQzG+7{%`KcDmMoBXpJ7Q(KXLT1fcJR-TgZ zBPSUj`rS7Gxwsl&Sy#eq3mqA#y#AQQU#@pn9SR^w#@gkjv)X-R1C)Qq2@Yjlal|xE z)T`%<^o6%Xm$@PJ?;e&W1&>%)K^gla5IE0<8ziIdh_p0guteU(`bVXmMdLz=g8wYg zuUfV;Rs*dgg1P}%cHx-FCf?_v^vZ3N(q6q^06g@pU5YD6$&}j+jXPiMf~QKAwL?xz z&^hMz@?#~Ftd*||ZzkM43=k_%5JIev?{1h8z0?h06}be&PQSt+Rxay=*p47M#BNoa zVb2@u;3*P~IF$azb|@W;{ZM|xYM~@BEtHK|6O>9!2jy9;4N5N72_*~bh0+!q0Fs=> zA(woBLoS(&LoVrtn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