Fixed negative/flipped axis matrix drawing.

This commit is contained in:
treeform 2021-11-07 15:42:53 -08:00
parent 16d9c9cbf2
commit 35fda58c33
2 changed files with 17 additions and 1 deletions

View file

@ -881,7 +881,10 @@ proc drawUber(
x += 16
var srcPos = p + dx * x.float32 + dy * y.float32
srcPos = vec2(max(0, srcPos.x), max(0, srcPos.y))
srcPos = vec2(
clamp(srcPos.x, 0, b.width.float32),
clamp(srcPos.y, 0, b.height.float32)
)
for x in x ..< xMax:
let samplePos = ivec2((srcPos.x - h).int32, (srcPos.y - h).int32)

View file

@ -202,3 +202,16 @@ block:
let image = newImage(100, 100)
image.fill(rgba(255, 255, 255, 255))
doAssert not image.isTransparent()
block:
let a = newImage(400, 400)
let b = newImage(156, 434)
b.fill(rgba(255, 0, 0, 255))
a.draw(
b,
mat3(
-0.5, -4.371138828673793e-008, 0.0,
-4.371138828673793e-008, 0.5, 0.0,
292.0, 45.0, 1.0
)
)