diff --git a/src/pixie/fileformats/jpeg.nim b/src/pixie/fileformats/jpeg.nim index 43dc6d0..8f0b91a 100644 --- a/src/pixie/fileformats/jpeg.nim +++ b/src/pixie/fileformats/jpeg.nim @@ -1,5 +1,5 @@ -import pixie/common, pixie/images, pixie/masks, sequtils, strutils, chroma, - std/decls, flatty/binny +import chroma, flatty/binny, pixie/common, pixie/images, pixie/masks, sequtils, + std/decls, strutils when defined(amd64) and not defined(pixieNoSimd): import nimsimd/sse2 @@ -906,13 +906,17 @@ proc magnifyXBy2(mask: Mask): Mask = let n = 3 * mask.unsafe[x, y].uint16 if x == 0: result.unsafe[x * 2 + 0, y] = mask.unsafe[x, y] - result.unsafe[x * 2 + 1, y] = ((n + mask.unsafe[x + 1, y].uint16 + 2) div 4).uint8 + result.unsafe[x * 2 + 1, y] = + ((n + mask.unsafe[x + 1, y].uint16 + 2) div 4).uint8 elif x == mask.width - 1: - result.unsafe[x * 2 + 0, y] = ((n + mask.unsafe[x - 1, y].uint16 + 2) div 4).uint8 + result.unsafe[x * 2 + 0, y] = + ((n + mask.unsafe[x - 1, y].uint16 + 2) div 4).uint8 result.unsafe[x * 2 + 1, y] = mask.unsafe[x, y] else: - result.unsafe[x * 2 + 0, y] = ((n + mask.unsafe[x - 1, y].uint16) div 4).uint8 - result.unsafe[x * 2 + 1, y] = ((n + mask.unsafe[x + 1, y].uint16) div 4).uint8 + result.unsafe[x * 2 + 0, y] = + ((n + mask.unsafe[x - 1, y].uint16) div 4).uint8 + result.unsafe[x * 2 + 1, y] = + ((n + mask.unsafe[x + 1, y].uint16) div 4).uint8 proc magnifyYBy2(mask: Mask): Mask = ## Smooth magnify by power of 2 only in the Y direction. @@ -922,13 +926,17 @@ proc magnifyYBy2(mask: Mask): Mask = let n = 3 * mask.unsafe[x, y].uint16 if y == 0: result.unsafe[x, y * 2 + 0] = mask.unsafe[x, y] - result.unsafe[x, y * 2 + 1] = ((n + mask.unsafe[x, y + 1].uint16 + 2) div 4).uint8 + result.unsafe[x, y * 2 + 1] = + ((n + mask.unsafe[x, y + 1].uint16 + 2) div 4).uint8 elif y == mask.height - 1: - result.unsafe[x, y * 2 + 0] = ((n + mask.unsafe[x, y - 1].uint16 + 2) div 4).uint8 + result.unsafe[x, y * 2 + 0] = + ((n + mask.unsafe[x, y - 1].uint16 + 2) div 4).uint8 result.unsafe[x, y * 2 + 1] = mask.unsafe[x, y] else: - result.unsafe[x, y * 2 + 0] = ((n + mask.unsafe[x, y - 1].uint16) div 4).uint8 - result.unsafe[x, y * 2 + 1] = ((n + mask.unsafe[x, y + 1].uint16) div 4).uint8 + result.unsafe[x, y * 2 + 0] = + ((n + mask.unsafe[x, y - 1].uint16) div 4).uint8 + result.unsafe[x, y * 2 + 1] = + ((n + mask.unsafe[x, y + 1].uint16) div 4).uint8 proc yCbCrToRgbx(py, pcb, pcr: uint8): ColorRGBX = ## Takes a 3 component yCbCr outputs and populates image. diff --git a/src/pixie/fileformats/svg.nim b/src/pixie/fileformats/svg.nim index 168ad1f..1a5e78a 100644 --- a/src/pixie/fileformats/svg.nim +++ b/src/pixie/fileformats/svg.nim @@ -519,7 +519,6 @@ proc parseSvg*( var rootProps = initSvgProperties() rootProps = root.parseSvgProperties(rootProps) - if viewBoxMinX != 0 or viewBoxMinY != 0: let viewBoxMin = vec2(-viewBoxMinX.float32, -viewBoxMinY.float32) rootprops.transform = rootprops.transform * translate(viewBoxMin) diff --git a/src/pixie/fontformats/opentype.nim b/src/pixie/fontformats/opentype.nim index 5d0e9e1..fde88ae 100644 --- a/src/pixie/fontformats/opentype.nim +++ b/src/pixie/fontformats/opentype.nim @@ -1,5 +1,5 @@ import flatty/binny, flatty/encode, math, pixie/common, pixie/paths, sets, - strutils, tables, unicode, vmath + strutils, tables, unicode, vmath ## See https://docs.microsoft.com/en-us/typography/opentype/spec/ @@ -663,7 +663,7 @@ proc parseNameTable(buf: string, offset: int): NameTable = if record.platformID == 3 and record.encodingID == 1 and record.languageID == 1033: - record.text = fromUTF16BE(record.text) + record.text = fromUTF16BE(record.text) record.text = record.text result.nameRecords.add(record) diff --git a/tests/test_fonts.nim b/tests/test_fonts.nim index 0ffff65..ce6ee67 100644 --- a/tests/test_fonts.nim +++ b/tests/test_fonts.nim @@ -1,4 +1,4 @@ -import pixie, pixie/fileformats/png, strformat, unicode, os +import os, pixie, pixie/fileformats/png, strformat, unicode proc wh(image: Image): Vec2 = ## Return with and height as a size vector. diff --git a/tests/test_svg.nim b/tests/test_svg.nim index e31e449..9bc7683 100644 --- a/tests/test_svg.nim +++ b/tests/test_svg.nim @@ -29,5 +29,8 @@ for file in files: doDiff(readImage(&"tests/fileformats/svg/{file}.svg"), file) block: - let svg = parseSvg(readFile("tests/fileformats/svg/accessibility-outline.svg"), 512, 512) + let svg = parseSvg( + readFile("tests/fileformats/svg/accessibility-outline.svg"), + 512, 512 + ) doDiff(newImage(svg), "accessibility-outline")