faster + benchmark
This commit is contained in:
parent
848a051310
commit
d18a268600
|
@ -506,7 +506,7 @@ proc drawCorrect(
|
|||
dy = matInv * vec2(0 + h, 1 + h) - p
|
||||
minFilterBy2 = max(dx.length, dy.length)
|
||||
|
||||
while minFilterBy2 > 2:
|
||||
while minFilterBy2 >= 2:
|
||||
b = b.minifyBy2()
|
||||
dx /= 2
|
||||
dy /= 2
|
||||
|
@ -563,7 +563,7 @@ proc drawUber(a, b: Image | Mask, mat = mat3(), blendMode = bmNormal) =
|
|||
minFilterBy2 = max(dx.length, dy.length)
|
||||
b = b
|
||||
|
||||
while minFilterBy2 > 2.0:
|
||||
while minFilterBy2 >= 2.0:
|
||||
b = b.minifyBy2()
|
||||
p /= 2
|
||||
dx /= 2
|
||||
|
|
|
@ -33,6 +33,8 @@ timeIt "minifyBy2":
|
|||
let minified = image.minifyBy2()
|
||||
doAssert minified[0, 0] == rgba(63, 127, 191, 191)
|
||||
|
||||
reset()
|
||||
|
||||
timeIt "magnifyBy2":
|
||||
let minified = image.magnifyBy2()
|
||||
doAssert minified[0, 0] == rgba(63, 127, 191, 191)
|
||||
|
|
|
@ -44,6 +44,17 @@ block:
|
|||
a.draw(b, translate(vec2(25.2, 25.2)), bmNormal)
|
||||
keep(b)
|
||||
|
||||
block:
|
||||
let
|
||||
a = newImage(1000, 1000)
|
||||
b = newImage(500, 500)
|
||||
a.fill(rgba(255, 0, 0, 255))
|
||||
b.fill(rgba(0, 255, 0, 255))
|
||||
|
||||
timeIt "draw big-on-bigger bmNormal scale(0.5)":
|
||||
a.draw(b, translate(vec2(25, 25)) * scale(vec2(0.5, 0.5)), bmNormal)
|
||||
keep(b)
|
||||
|
||||
block:
|
||||
let
|
||||
a = newImage(100, 100)
|
||||
|
|
Loading…
Reference in a new issue