early exists + fix for dll
This commit is contained in:
parent
625c473ef8
commit
4760b2643f
3 changed files with 31 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
||||||
import bitops, flatty/binny, math, pixie/common, pixie/paths, sets, tables,
|
import flatty/binny, math, pixie/common, pixie/paths, sets, tables,
|
||||||
unicode, vmath
|
unicode, vmath
|
||||||
|
|
||||||
## See https://docs.microsoft.com/en-us/typography/opentype/spec/
|
## See https://docs.microsoft.com/en-us/typography/opentype/spec/
|
||||||
|
@ -867,8 +867,15 @@ proc parseCoverage(buf: string, offset: int): Coverage =
|
||||||
else:
|
else:
|
||||||
failUnsupported()
|
failUnsupported()
|
||||||
|
|
||||||
proc valueFormatSize(valueFormat: uint16): int {.inline.} =
|
proc valueFormatSize(valueFormat: uint16): int =
|
||||||
countSetBits(valueFormat) * 2
|
# countSetBits(valueFormat) * 2
|
||||||
|
var
|
||||||
|
n = valueFormat
|
||||||
|
bitsSet: int
|
||||||
|
while n > 0:
|
||||||
|
n = (n and (n - 1))
|
||||||
|
inc bitsSet
|
||||||
|
bitsSet * 2
|
||||||
|
|
||||||
proc parseValueRecord(
|
proc parseValueRecord(
|
||||||
buf: string, offset: int, valueFormat: uint16
|
buf: string, offset: int, valueFormat: uint16
|
||||||
|
|
|
@ -413,7 +413,7 @@ proc parseOtf*(buf: string): Font =
|
||||||
result.typeface.opentype = parseOpenType(buf)
|
result.typeface.opentype = parseOpenType(buf)
|
||||||
result.size = 12
|
result.size = 12
|
||||||
result.lineHeight = AutoLineHeight
|
result.lineHeight = AutoLineHeight
|
||||||
result.paint = Paint(kind: pkSolid, color: rgbx(0, 0, 0, 255))
|
result.paint = rgbx(0, 0, 0, 255)
|
||||||
|
|
||||||
proc parseTtf*(buf: string): Font =
|
proc parseTtf*(buf: string): Font =
|
||||||
parseOtf(buf)
|
parseOtf(buf)
|
||||||
|
|
|
@ -500,6 +500,11 @@ proc roundedRect*(
|
||||||
## Adds a rounded rectangle.
|
## Adds a rounded rectangle.
|
||||||
## Clockwise param can be used to subtract a rect from a path when using
|
## Clockwise param can be used to subtract a rect from a path when using
|
||||||
## even-odd winding rule.
|
## even-odd winding rule.
|
||||||
|
|
||||||
|
if nw == 0 and ne == 0 and se == 0 and sw == 0:
|
||||||
|
path.rect(x, y, w, h, clockwise)
|
||||||
|
return
|
||||||
|
|
||||||
let
|
let
|
||||||
s = splineCircleK
|
s = splineCircleK
|
||||||
|
|
||||||
|
@ -1551,9 +1556,10 @@ proc fillPath*(
|
||||||
) =
|
) =
|
||||||
## Fills a path.
|
## Fills a path.
|
||||||
if paint.kind == pkSolid:
|
if paint.kind == pkSolid:
|
||||||
var shapes = parseSomePath(path, transform.pixelScale())
|
if paint.color.a > 0:
|
||||||
shapes.transform(transform)
|
var shapes = parseSomePath(path, transform.pixelScale())
|
||||||
image.fillShapes(shapes, paint.color, windingRule, paint.blendMode)
|
shapes.transform(transform)
|
||||||
|
image.fillShapes(shapes, paint.color, windingRule, paint.blendMode)
|
||||||
return
|
return
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -1614,16 +1620,17 @@ proc strokePath*(
|
||||||
) =
|
) =
|
||||||
## Strokes a path.
|
## Strokes a path.
|
||||||
if paint.kind == pkSolid:
|
if paint.kind == pkSolid:
|
||||||
var strokeShapes = strokeShapes(
|
if paint.color.a > 0:
|
||||||
parseSomePath(path, transform.pixelScale()),
|
var strokeShapes = strokeShapes(
|
||||||
strokeWidth,
|
parseSomePath(path, transform.pixelScale()),
|
||||||
lineCap,
|
strokeWidth,
|
||||||
lineJoin,
|
lineCap,
|
||||||
miterLimit,
|
lineJoin,
|
||||||
dashes
|
miterLimit,
|
||||||
)
|
dashes
|
||||||
strokeShapes.transform(transform)
|
)
|
||||||
image.fillShapes(strokeShapes, paint.color, wrNonZero, paint.blendMode)
|
strokeShapes.transform(transform)
|
||||||
|
image.fillShapes(strokeShapes, paint.color, wrNonZero, paint.blendMode)
|
||||||
return
|
return
|
||||||
|
|
||||||
let
|
let
|
||||||
|
|
Loading…
Reference in a new issue