diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 064e468..9977fff 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,5 +13,6 @@ jobs: - uses: actions/checkout@v2 - uses: jiro4989/setup-nim-action@v1 - run: nimble test -d:release -y + - run: nimble test -d:release -d:pixieNoSimd -y - run: nimble test --gc:orc -d:release -y - run: nim cpp -d:release -r tests/all.nim diff --git a/src/pixie/images.nim b/src/pixie/images.nim index f5614a7..b4185b0 100644 --- a/src/pixie/images.nim +++ b/src/pixie/images.nim @@ -753,31 +753,32 @@ proc drawUber(a, b: Image | Mask, mat = mat3(), blendMode = bmNormal) = ) x += 16 - for _ in x ..< xMax: - let - srcPos = p + dx * x.float32 + dy * y.float32 - xFloat = srcPos.x - h - yFloat = srcPos.y - h + var srcPos = p + dx * x.float32 + dy * y.float32 + srcPos = vec2(max(0, srcPos.x), max(0, srcPos.y)) + + for x in x ..< xMax: + let samplePos = ivec2((srcPos.x - h).int32, (srcPos.y - h).int32) when type(a) is Image: let backdrop = a.getRgbaUnsafe(x, y) when type(b) is Image: let - sample = b.getRgbaUnsafe(xFloat.int, yFloat.int) + sample = b.getRgbaUnsafe(samplePos.x, samplePos.y) blended = blender(backdrop, sample) else: # b is a Mask let - sample = b.getValueUnsafe(xFloat.int, yFloat.int) + sample = b.getValueUnsafe(samplePos.x, samplePos.y) blended = blender(backdrop, rgbx(0, 0, 0, sample)) a.setRgbaUnsafe(x, y, blended) else: # a is a Mask let backdrop = a.getValueUnsafe(x, y) when type(b) is Image: - let sample = b.getRgbaUnsafe(xFloat.int, yFloat.int).a + let sample = b.getRgbaUnsafe(samplePos.x, samplePos.y).a else: # b is a Mask - let sample = b.getValueUnsafe(xFloat.int, yFloat.int) + let sample = b.getValueUnsafe(samplePos.x, samplePos.y) a.setValueUnsafe(x, y, masker(backdrop, sample)) - inc x + + srcPos += dx if blendMode == bmIntersectMask: if a.width - xMax > 0: