diff --git a/tests/benchmark_blends.nim b/tests/benchmark_blends.nim index a1e25fc..2052f85 100644 --- a/tests/benchmark_blends.nim +++ b/tests/benchmark_blends.nim @@ -28,11 +28,11 @@ timeIt "blendMultiply": for i in 0 ..< backdrop.data.len: backdrop.data[i] = blendMultiply(backdrop.data[i], source.data[i]) -reset() +# reset() -timeIt "blendLinearBurn": - for i in 0 ..< backdrop.data.len: - backdrop.data[i] = blendLinearBurn(backdrop.data[i], source.data[i]) +# timeIt "blendLinearBurn": +# for i in 0 ..< backdrop.data.len: +# backdrop.data[i] = blendLinearBurn(backdrop.data[i], source.data[i]) reset() @@ -52,11 +52,11 @@ timeIt "blendScreen": for i in 0 ..< backdrop.data.len: backdrop.data[i] = blendScreen(backdrop.data[i], source.data[i]) -reset() +# reset() -timeIt "blendLinearDodge": - for i in 0 ..< backdrop.data.len: - backdrop.data[i] = blendLinearDodge(backdrop.data[i], source.data[i]) +# timeIt "blendLinearDodge": +# for i in 0 ..< backdrop.data.len: +# backdrop.data[i] = blendLinearDodge(backdrop.data[i], source.data[i]) reset() @@ -132,12 +132,6 @@ timeIt "blendSubtractMask": reset() -timeIt "blendIntersectMask": - for i in 0 ..< backdrop.data.len: - backdrop.data[i] = blendIntersectMask(backdrop.data[i], source.data[i]) - -reset() - timeIt "blendExcludeMask": for i in 0 ..< backdrop.data.len: backdrop.data[i] = blendExcludeMask(backdrop.data[i], source.data[i]) diff --git a/tests/benchmark_drawCorrect_vs_drawUber.nim b/tests/benchmark_drawCorrect_vs_drawUber.nim index b8108c8..2cd166d 100644 --- a/tests/benchmark_drawCorrect_vs_drawUber.nim +++ b/tests/benchmark_drawCorrect_vs_drawUber.nim @@ -10,7 +10,7 @@ block: b.fill(rgba(0, 255, 0, 255)) timeIt "drawCorrect small-on-big": - a.drawCorrect(b, translate(vec2(25, 25)), bmNormal) + a.drawCorrect(b, translate(vec2(25, 25)), blendMode = bmNormal) keep(b) block: @@ -21,7 +21,7 @@ block: b.fill(rgba(0, 255, 0, 255)) timeIt "drawUber small-on-big": - a.drawUber(b, translate(vec2(25, 25)), bmNormal) + a.drawUber(b, translate(vec2(25, 25)), blendMode = bmNormal) keep(b) block: @@ -32,7 +32,7 @@ block: b.fill(rgba(0, 255, 0, 255)) timeIt "drawCorrect small-on-big smooth": - a.drawCorrect(b, translate(vec2(25.1, 25.1)), bmNormal) + a.drawCorrect(b, translate(vec2(25.1, 25.1)), blendMode = bmNormal) keep(b) block: @@ -43,5 +43,5 @@ block: b.fill(rgba(0, 255, 0, 255)) timeIt "drawUber small-on-big smooth": - a.drawUber(b, translate(vec2(25.1, 25.1)), bmNormal) + a.drawUber(b, translate(vec2(25.1, 25.1)), blendMode = bmNormal) keep(b) diff --git a/tests/benchmark_fonts.nim b/tests/benchmark_fonts.nim index 301b3b8..429bbf7 100644 --- a/tests/benchmark_fonts.nim +++ b/tests/benchmark_fonts.nim @@ -7,13 +7,13 @@ font.size = 16 let image = newImage(500, 300) - mask = newMask(500, 300) + # mask = newMask(500, 300) timeIt "typeset": - discard font.typeset(text, bounds = image.wh) + discard font.typeset(text, bounds = vec2(image.width.float32, 0)) timeIt "rasterize": image.fill(rgba(255, 255, 255, 255)) - image.fillText(font, text, bounds = image.wh) + image.fillText(font, text, bounds = vec2(image.width.float32, 0)) # mask.fill(0) # mask.fillText(font, text, bounds = mask.wh) diff --git a/tests/benchmark_gif.nim b/tests/benchmark_gif.nim index ae02f7d..78bc373 100644 --- a/tests/benchmark_gif.nim +++ b/tests/benchmark_gif.nim @@ -1,6 +1,6 @@ import benchy, pixie/fileformats/gif -let data = readFile("tests/images/gif/audrey.gif") +let data = readFile("tests/fileformats/gif/audrey.gif") timeIt "pixie decode": keep decodeGif(data) diff --git a/tests/benchmark_images.nim b/tests/benchmark_images.nim index 428fbd0..d0955ac 100644 --- a/tests/benchmark_images.nim +++ b/tests/benchmark_images.nim @@ -70,7 +70,7 @@ timeIt "toStraightAlpha": reset() block: - var path: Path + let path = newPath() path.ellipse(image.width / 2, image.height / 2, 300, 300) let mask = newMask(image.width, image.height) diff --git a/tests/benchmark_images_blur.nim b/tests/benchmark_images_blur.nim index 0007474..f04d215 100644 --- a/tests/benchmark_images_blur.nim +++ b/tests/benchmark_images_blur.nim @@ -68,7 +68,7 @@ proc blurSlower*( let image = newImage(1920, 1080) proc reset() = - var path: Path + let path = newPath() path.rect(100, 100, 1720, 880) image.fillPath(path, rgba(255, 255, 255, 255)) diff --git a/tests/benchmark_jpg.nim b/tests/benchmark_jpg.nim index 6420e2a..4a68227 100644 --- a/tests/benchmark_jpg.nim +++ b/tests/benchmark_jpg.nim @@ -1,6 +1,6 @@ import benchy, pixie/fileformats/jpg -let data = readFile("tests/images/jpg/jpeg420exif.jpg") +let data = readFile("tests/fileformats/jpg/jpeg420exif.jpg") timeIt "pixie decode": discard decodeJpg(cast[seq[uint8]](data)) diff --git a/tests/benchmark_masks.nim b/tests/benchmark_masks.nim index 5c0a550..57c6a23 100644 --- a/tests/benchmark_masks.nim +++ b/tests/benchmark_masks.nim @@ -34,7 +34,7 @@ timeIt "ceil": reset() block spread_1: - var p: Path + let p = newPath() p.rect(500, 500, 500, 500) timeIt "spread_1": @@ -43,7 +43,7 @@ block spread_1: mask.spread(10) block spread_2: - var p: Path + let p = newPath() p.rect(500, 500, 1000, 1000) timeIt "spread_2": diff --git a/tests/benchmark_paths.nim b/tests/benchmark_paths.nim index 98e9072..080d76e 100644 --- a/tests/benchmark_paths.nim +++ b/tests/benchmark_paths.nim @@ -11,7 +11,7 @@ image.fill(rgba(255, 255, 255, 255)) timeIt "roundedRect": const radius = 20 - var path: Path + let path = newPath() path.roundedRect(0.5, 0.5, 499, 299, radius, radius, radius, radius) # path.roundedRect(0, 0, 500, 300, radius, radius, radius, radius) diff --git a/tests/benchmark_png.nim b/tests/benchmark_png.nim index 137977d..29ad32a 100644 --- a/tests/benchmark_png.nim +++ b/tests/benchmark_png.nim @@ -2,7 +2,7 @@ import benchy, cairo, nimPNG, pixie/fileformats/png, stb_image/read as stbi, stb_image/write as stbr let - filePath = "tests/images/png/lenna.png" + filePath = "tests/fileformats/png/lenna.png" data = readFile(filePath) timeIt "pixie decode": diff --git a/tests/benchmark_svg.nim b/tests/benchmark_svg.nim index e36e3a6..a17351d 100644 --- a/tests/benchmark_svg.nim +++ b/tests/benchmark_svg.nim @@ -1,6 +1,6 @@ import benchy, pixie/fileformats/svg -let data = readFile("tests/images/svg/Ghostscript_Tiger.svg") +let data = readFile("tests/fileformats/svg/Ghostscript_Tiger.svg") timeIt "svg decode": keep decodeSvg(data) diff --git a/tests/fuzz_gif.nim b/tests/fuzz_gif.nim index 645cde1..0f85fee 100644 --- a/tests/fuzz_gif.nim +++ b/tests/fuzz_gif.nim @@ -2,7 +2,7 @@ import pixie/common, pixie/fileformats/gif, random, strformat randomize() -let original = readFile("tests/images/gif/sunflower.gif") +let original = readFile("tests/fileformats/gif/sunflower.gif") for i in 0 ..< 10_000: var data = original diff --git a/tests/fuzz_jpg.nim b/tests/fuzz_jpg.nim index ea366e7..003b970 100644 --- a/tests/fuzz_jpg.nim +++ b/tests/fuzz_jpg.nim @@ -2,7 +2,7 @@ import pixie/common, pixie/fileformats/jpg, random, strformat randomize() -let original = cast[seq[uint8]](readFile("tests/images/jpg/jpeg420exif.jpg")) +let original = cast[seq[uint8]](readFile("tests/fileformats/jpg/jpeg420exif.jpg")) for i in 0 ..< 10_000: var data = original diff --git a/tests/fuzz_leaks3.nim b/tests/fuzz_leaks3.nim index 7c4949c..1572861 100644 --- a/tests/fuzz_leaks3.nim +++ b/tests/fuzz_leaks3.nim @@ -5,7 +5,7 @@ when not defined(pixieLeakCheck): randomize() -let data = readFile("tests/images/svg/Ghostscript_Tiger.svg") +let data = readFile("tests/fileformats/svg/Ghostscript_Tiger.svg") for i in 0 ..< 100_000: var image = decodeSvg(data, rand(300 .. 1800), rand(30 .. 1800)) diff --git a/tests/fuzz_paths.nim b/tests/fuzz_paths.nim index 8237878..af297ba 100644 --- a/tests/fuzz_paths.nim +++ b/tests/fuzz_paths.nim @@ -12,14 +12,12 @@ for i in 0 ..< 10_000: data[pos] = value echo &"{i} {pos} {value.uint8}" try: - let path = parsePath(data) - doAssert path.commands.len >= 0 + discard parsePath(data) except PixieError: discard data = data[0 ..< pos] try: - let path = parsePath(data) - doAssert path.commands.len >= 0 + discard parsePath(data) except PixieError: discard diff --git a/tests/fuzz_png.nim b/tests/fuzz_png.nim index 631d376..9e10dd9 100644 --- a/tests/fuzz_png.nim +++ b/tests/fuzz_png.nim @@ -4,13 +4,11 @@ randomize() for i in 0 ..< 10_000: let file = pngSuiteFiles[rand(pngSuiteFiles.len - 1)] - var data = cast[seq[uint8]]( - readFile(&"tests/images/png/pngsuite/{file}.png") - ) + var data = readFile(&"tests/fileformats/png/pngsuite/{file}.png") let pos = 29 + rand(data.len - 30) value = rand(255).uint8 - data[pos] = value + data[pos] = value.char echo &"{i} {file} {pos} {value}" try: let img = decodePng(data) diff --git a/tests/fuzz_svg.nim b/tests/fuzz_svg.nim index 7356a18..89a4e75 100644 --- a/tests/fuzz_svg.nim +++ b/tests/fuzz_svg.nim @@ -2,7 +2,7 @@ import pixie/common, pixie/fileformats/svg, random, strformat randomize() -let original = readFile("tests/images/svg/Ghostscript_Tiger.svg") +let original = readFile("tests/fileformats/svg/Ghostscript_Tiger.svg") for i in 0 ..< 10_000: var data = original diff --git a/tests/megatest_emoji.nim b/tests/megatest_emoji.nim index a1cf63a..7e66509 100644 --- a/tests/megatest_emoji.nim +++ b/tests/megatest_emoji.nim @@ -57,7 +57,7 @@ proc renderEmojiSet(index: int) = bmOverwrite ) - rendered.writeFile(&"tests/images/svg/{emojiSet.name}.png") + rendered.writeFile(&"tests/fileformats/svg/{emojiSet.name}.png") proc main(index = -1) = if index >= 0: diff --git a/tests/megatest_icons.nim b/tests/megatest_icons.nim index a1e6a59..7a94b7e 100644 --- a/tests/megatest_icons.nim +++ b/tests/megatest_icons.nim @@ -58,7 +58,7 @@ proc renderIconSet(index: int) = bmOverwrite ) - rendered.writeFile(&"tests/images/svg/{iconSet.name}.png") + rendered.writeFile(&"tests/fileformats/svg/{iconSet.name}.png") proc main(index = -1) = if index >= 0: diff --git a/tests/validate_jpg.nim b/tests/validate_jpg.nim index 93de6ad..2137c03 100644 --- a/tests/validate_jpg.nim +++ b/tests/validate_jpg.nim @@ -1,3 +1,3 @@ import pixie/fileformats/jpg, pixie/fileformats/stb_image/stb_image -let original = readFile("tests/images/jpg/jpeg420exif.jpg") +let original = readFile("tests/fileformats/jpg/jpeg420exif.jpg") diff --git a/tests/validate_png.nim b/tests/validate_png.nim index d5be59f..b39b5f6 100644 --- a/tests/validate_png.nim +++ b/tests/validate_png.nim @@ -2,8 +2,8 @@ import chroma, pixie/fileformats/png, pngsuite, stb_image/read as stbi, strforma for file in pngSuiteFiles: let - data = readFile(&"tests/images/png/pngsuite/{file}.png") - pixieLoaded = decodePng(cast[seq[uint8]](data)) + data = readFile(&"tests/fileformats/png/pngsuite/{file}.png") + pixieLoaded = decodePngRaw(data) var width, height, channels: int