2020-11-22 00:51:29 +00:00
|
|
|
import pixie, chroma, vmath, fidget/opengl/perf, pixie/fileformats/bmp
|
|
|
|
|
2020-11-25 01:49:43 +00:00
|
|
|
# timeIt "drawOverwrite bmOverwrite":
|
|
|
|
# var tmp = 0
|
|
|
|
# var c: Image
|
|
|
|
# for i in 0 ..< 1000:
|
|
|
|
# var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
# var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
# c = a.drawOverwrite(b, translate(vec2(25, 25))) # Copy
|
|
|
|
# tmp += c.width * c.height
|
|
|
|
# c.writeFile("tests/images/bench.drawOverwrite.bmOverwrite.png")
|
|
|
|
# echo tmp
|
2020-11-22 00:51:29 +00:00
|
|
|
|
2020-11-25 01:49:43 +00:00
|
|
|
# timeIt "drawBlend bmOverwrite":
|
|
|
|
# var tmp = 0
|
|
|
|
# var c: Image
|
|
|
|
# for i in 0 ..< 1000:
|
|
|
|
# var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
# var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
# c = a.drawBlend(b, translate(vec2(25, 25)), bmOverwrite)
|
|
|
|
# tmp += c.width * c.height
|
|
|
|
# c.writeFile("tests/images/bench.drawBlend.bmOverwrite.png")
|
|
|
|
# echo tmp
|
2020-11-22 00:51:29 +00:00
|
|
|
|
2020-11-25 01:49:43 +00:00
|
|
|
# timeIt "drawBlendSmooth bmOverwrite":
|
|
|
|
# var tmp = 0
|
|
|
|
# var c: Image
|
|
|
|
# for i in 0 ..< 1000:
|
|
|
|
# var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
# var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
# c = a.drawBlendSmooth(b, translate(vec2(25, 25)), bmOverwrite)
|
|
|
|
# tmp += c.width * c.height
|
|
|
|
# c.writeFile("tests/images/bench.drawBlendSmooth.bmOverwrite.png")
|
|
|
|
# echo tmp
|
2020-11-22 00:51:29 +00:00
|
|
|
|
2020-11-23 03:24:00 +00:00
|
|
|
timeIt "drawBlend bmNormal":
|
2020-11-22 00:51:29 +00:00
|
|
|
var tmp = 0
|
|
|
|
var c: Image
|
|
|
|
for i in 0 ..< 1000:
|
2020-11-25 01:49:43 +00:00
|
|
|
var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
2020-11-23 03:24:00 +00:00
|
|
|
c = a.drawBlend(b, translate(vec2(25, 25)), bmNormal)
|
2020-11-22 00:51:29 +00:00
|
|
|
tmp += c.width * c.height
|
2020-11-23 03:24:00 +00:00
|
|
|
c.writeFile("tests/images/bench.drawBlend.bmNormal.png")
|
2020-11-22 00:51:29 +00:00
|
|
|
echo tmp
|
|
|
|
|
2020-11-23 03:24:00 +00:00
|
|
|
timeIt "drawBlendSmooth bmNormal":
|
2020-11-22 00:51:29 +00:00
|
|
|
var tmp = 0
|
|
|
|
var c: Image
|
|
|
|
for i in 0 ..< 1000:
|
2020-11-25 01:49:43 +00:00
|
|
|
var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
2020-11-23 03:24:00 +00:00
|
|
|
c = a.drawBlendSmooth(b, translate(vec2(25, 25)), bmNormal)
|
2020-11-22 00:51:29 +00:00
|
|
|
tmp += c.width * c.height
|
2020-11-23 03:24:00 +00:00
|
|
|
c.writeFile("tests/images/bench.drawBlendSmooth.bmNormal.png")
|
2020-11-22 00:51:29 +00:00
|
|
|
echo tmp
|
|
|
|
|
2020-11-25 01:49:43 +00:00
|
|
|
timeIt "drawCorrect bmNormal":
|
2020-11-22 00:51:29 +00:00
|
|
|
var tmp = 0
|
|
|
|
var c: Image
|
|
|
|
for i in 0 ..< 1000:
|
2020-11-25 01:49:43 +00:00
|
|
|
var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
c = a.drawCorrect(b, translate(vec2(25, 25)), bmNormal)
|
2020-11-22 00:51:29 +00:00
|
|
|
tmp += c.width * c.height
|
2020-11-25 01:49:43 +00:00
|
|
|
c.writeFile("tests/images/bench.drawCorrect.bmNormal.png")
|
2020-11-22 00:51:29 +00:00
|
|
|
echo tmp
|
|
|
|
|
2020-11-25 01:49:43 +00:00
|
|
|
timeIt "drawStepper bmNormal":
|
2020-11-22 00:51:29 +00:00
|
|
|
var tmp = 0
|
|
|
|
var c: Image
|
|
|
|
for i in 0 ..< 1000:
|
2020-11-25 01:49:43 +00:00
|
|
|
var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
c = a.drawStepper(b, translate(vec2(25, 25)), bmNormal)
|
2020-11-22 00:51:29 +00:00
|
|
|
tmp += c.width * c.height
|
2020-11-25 01:49:43 +00:00
|
|
|
c.writeFile("tests/images/bench.drawStepper.bmNormal.png")
|
2020-11-22 00:51:29 +00:00
|
|
|
echo tmp
|
|
|
|
|
2020-11-25 18:09:12 +00:00
|
|
|
timeIt "drawInPlace bmNormal":
|
|
|
|
var tmp = 0
|
2020-11-26 06:32:50 +00:00
|
|
|
var a: Image
|
2020-11-25 18:09:12 +00:00
|
|
|
for i in 0 ..< 1000:
|
2020-11-26 06:32:50 +00:00
|
|
|
a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
2020-11-25 18:09:12 +00:00
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
a.drawInPlace(b, translate(vec2(25, 25)), bmNormal)
|
|
|
|
tmp += a.width * a.height
|
2020-11-26 06:32:50 +00:00
|
|
|
a.writeFile("tests/images/bench.drawInPlace.bmNormal.png")
|
|
|
|
echo tmp
|
|
|
|
|
|
|
|
timeIt "drawUberCopy bmNormal":
|
|
|
|
var tmp = 0
|
|
|
|
var c: Image
|
|
|
|
for i in 0 ..< 1000:
|
|
|
|
var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
c = a.drawUberCopy(b, translate(vec2(25, 25)), bmNormal)
|
|
|
|
tmp += c.width * c.height
|
|
|
|
c.writeFile("tests/images/bench.drawUberCopy.bmNormal.png")
|
|
|
|
echo tmp
|
|
|
|
|
|
|
|
timeIt "drawUberInPlace bmNormal":
|
|
|
|
var tmp = 0
|
|
|
|
var a: Image
|
|
|
|
for i in 0 ..< 1000:
|
|
|
|
a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
a.drawUberInPlace(b, translate(vec2(25, 25)), bmNormal)
|
|
|
|
tmp += a.width * a.height
|
|
|
|
a.writeFile("tests/images/bench.drawUberInPlace.bmNormal.png")
|
|
|
|
echo tmp
|
|
|
|
|
|
|
|
timeIt "drawUberCopy Smooth bmNormal":
|
|
|
|
var tmp = 0
|
|
|
|
var c: Image
|
|
|
|
for i in 0 ..< 1000:
|
|
|
|
var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
c = a.drawUberCopy(b, translate(vec2(25.2, 25.2)), bmNormal)
|
|
|
|
tmp += c.width * c.height
|
|
|
|
c.writeFile("tests/images/bench.drawUberCopy.Smooth.bmNormal.png")
|
|
|
|
echo tmp
|
|
|
|
|
|
|
|
timeIt "drawUberInPlace Smooth bmNormal":
|
|
|
|
var tmp = 0
|
|
|
|
var a: Image
|
|
|
|
for i in 0 ..< 1000:
|
|
|
|
a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
var b = newImageFill(100, 100, rgba(0, 255, 0, 255))
|
|
|
|
a.drawUberInPlace(b, translate(vec2(25.2, 25.2)), bmNormal)
|
|
|
|
tmp += a.width * a.height
|
|
|
|
a.writeFile("tests/images/bench.drawUberInPlace.Smooth.bmNormal.png")
|
2020-11-25 18:09:12 +00:00
|
|
|
echo tmp
|
|
|
|
|
2020-11-25 01:49:43 +00:00
|
|
|
# timeIt "drawBlend bmSaturation":
|
|
|
|
# var tmp = 0
|
|
|
|
# var c: Image
|
|
|
|
# for i in 0 ..< 1000:
|
|
|
|
# var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
# var b = newImageFill(100, 100, rgba(0, 0, 0, 255))
|
|
|
|
# c = a.drawBlend(b, translate(vec2(25, 25)), bmSaturation)
|
|
|
|
# tmp += c.width * c.height
|
|
|
|
# c.writeFile("tests/images/bench.drawBlend.bmSaturation.png")
|
|
|
|
# echo tmp
|
|
|
|
|
|
|
|
# timeIt "drawBlendSmooth bmSaturation":
|
|
|
|
# var tmp = 0
|
|
|
|
# var c: Image
|
|
|
|
# for i in 0 ..< 1000:
|
|
|
|
# var a = newImageFill(100, 100, rgba(255, 0, 0, 255))
|
|
|
|
# var b = newImageFill(100, 100, rgba(0, 0, 0, 255))
|
|
|
|
# c = a.drawBlendSmooth(b, translate(vec2(25, 25)), bmSaturation)
|
|
|
|
# tmp += c.width * c.height
|
|
|
|
# c.writeFile("tests/images/bench.drawBlendSmooth.bmSaturation.png")
|
|
|
|
# echo tmp
|
|
|
|
|
2020-11-23 03:24:00 +00:00
|
|
|
# timeIt "benchDrawFast3 Rotation":
|
|
|
|
# var tmp = 0
|
|
|
|
# var c: Image
|
|
|
|
# for i in 0 ..< 1000:
|
|
|
|
# var a = newImage(100, 100)
|
|
|
|
# a.fill(rgba(255, 0, 0, 255))
|
|
|
|
# var b = newImage(100, 100)
|
|
|
|
# b.fill(rgba(0, 0, 0, 255))
|
|
|
|
# c = a.drawFast3(b, translate(vec2(25, 25)) * rotationMat3(PI/2), bmNormal)
|
|
|
|
# tmp += c.width * c.height
|
|
|
|
# c.writeFile("tests/images/benchDrawFast3Rotation.png")
|
|
|
|
# echo tmp
|