diff --git a/src/pixie/images.nim b/src/pixie/images.nim index 59b7bd8..8ceac10 100644 --- a/src/pixie/images.nim +++ b/src/pixie/images.nim @@ -39,10 +39,6 @@ proc newImage*(mask: Mask): Image {.raises: [PixieError].} = let v = mask.data[i] result.data[i] = rgbx(v, v, v, v) -proc wh*(image: Image): Vec2 {.inline, raises: [].} = - ## Return with and height as a size vector. - vec2(image.width.float32, image.height.float32) - proc copy*(image: Image): Image {.raises: [PixieError].} = ## Copies the image data into a new image. result = newImage(image.width, image.height) diff --git a/src/pixie/masks.nim b/src/pixie/masks.nim index 6a99ebd..00b27fb 100644 --- a/src/pixie/masks.nim +++ b/src/pixie/masks.nim @@ -22,10 +22,6 @@ proc newMask*(width, height: int): Mask {.raises: [PixieError].} = result.height = height result.data = newSeq[uint8](width * height) -proc wh*(mask: Mask): Vec2 {.inline, raises: [].} = - ## Return with and height as a size vector. - vec2(mask.width.float32, mask.height.float32) - proc copy*(mask: Mask): Mask {.raises: [PixieError].} = ## Copies the image data into a new image. result = newMask(mask.width, mask.height) diff --git a/src/pixie/paths.nim b/src/pixie/paths.nim index 037aa3a..82a6ff7 100644 --- a/src/pixie/paths.nim +++ b/src/pixie/paths.nim @@ -1149,7 +1149,7 @@ iterator walk( numHits: int, windingRule: WindingRule, y: int, - size: Vec2 + width: float32 ): (float32, float32, int32) = var prevAt: float32 @@ -1170,14 +1170,14 @@ iterator walk( count += winding when defined(pixieLeakCheck): - if prevAt != size.x and count != 0: + if prevAt != width and count != 0: echo "Leak detected: ", count, " @ (", prevAt, ", ", y, ")" proc computeCoverages( coverages: var seq[uint8], hits: var seq[(float32, int16)], numHits: var int, - size: Vec2, + width: float32, y, startX: int, aa: bool, partitioning: Partitioning, @@ -1196,7 +1196,7 @@ proc computeCoverages( let partitionIndex = partitioning.getIndexForY(y) var yLine = y.float32 + initialOffset - offset - scanline = line(vec2(0, yLine), vec2(size.x, yLine)) + scanline = line(vec2(0, yLine), vec2(width, yLine)) for m in 0 ..< quality: yLine += offset scanline.a.y = yLine @@ -1212,13 +1212,13 @@ proc computeCoverages( if segment.to != at: if numHits == hits.len: hits.setLen(hits.len * 2) - hits[numHits] = (min(at.x, size.x), winding) + hits[numHits] = (min(at.x, width), winding) inc numHits sort(hits, 0, numHits - 1) if aa: - for (prevAt, at, count) in hits.walk(numHits, windingRule, y, size): + for (prevAt, at, count) in hits.walk(numHits, windingRule, y, width): var fillStart = prevAt.int let @@ -1403,7 +1403,7 @@ proc fillHits( ) = let blender = blendMode.blender() var filledTo: int - for (prevAt, at, count) in hits.walk(numHits, windingRule, y, image.wh): + for (prevAt, at, count) in hits.walk(numHits, windingRule, y, image.width.float32): let fillStart = prevAt.int fillLen = at.int - fillStart @@ -1451,7 +1451,7 @@ proc fillHits( ) = let masker = blendMode.masker() var filledTo: int - for (prevAt, at, count) in hits.walk(numHits, windingRule, y, mask.wh): + for (prevAt, at, count) in hits.walk(numHits, windingRule, y, mask.width.float32): let fillStart = prevAt.int fillLen = at.int - fillStart @@ -1515,7 +1515,7 @@ proc fillShapes( coverages, hits, numHits, - image.wh, + image.width.float32, y, startX, aa, @@ -1572,7 +1572,7 @@ proc fillShapes( coverages, hits, numHits, - mask.wh, + mask.width.float32, y, startX, aa, diff --git a/tests/test_fonts.nim b/tests/test_fonts.nim index 114e1ce..03b0b46 100644 --- a/tests/test_fonts.nim +++ b/tests/test_fonts.nim @@ -1,5 +1,9 @@ import pixie, pixie/fileformats/png, strformat, unicode +proc wh(image: Image): Vec2 = + ## Return with and height as a size vector. + vec2(image.width.float32, image.height.float32) + proc doDiff(rendered: Image, name: string) = rendered.writeFile(&"tests/fonts/rendered/{name}.png") let