From acc1d6bc93768724b64c5c4884b097fd39389aff Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Sat, 21 May 2022 16:42:34 -0500 Subject: [PATCH] simpler --- src/pixie/fileformats/svg.nim | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/pixie/fileformats/svg.nim b/src/pixie/fileformats/svg.nim index 71bcf61..e3918a2 100644 --- a/src/pixie/fileformats/svg.nim +++ b/src/pixie/fileformats/svg.nim @@ -345,7 +345,7 @@ proc stroke(img: Image, ctx: Ctx, path: Path) {.inline.} = dashes = ctx.strokeDashArray ) -proc drawInternal(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) = +proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) = if node.kind != xnElement: # Skip return @@ -362,7 +362,7 @@ proc drawInternal(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) = let ctx = decodeCtx(ctxStack[^1], node) ctxStack.add(ctx) for child in node: - img.drawInternal(child, ctxStack) + img.draw(child, ctxStack) discard ctxStack.pop() of "path": @@ -552,14 +552,6 @@ proc drawInternal(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) = else: raise newException(PixieError, "Unsupported SVG tag: " & node.tag) -proc draw(img: Image, node: XmlNode, ctxStack: var seq[Ctx]) = - try: - drawInternal(img, node, ctxStack) - except PixieError as e: - raise e - except: - raise currentExceptionAsPixieError() - proc decodeSvg*( data: string | XmlNode, width = 0, height = 0 ): Image {.raises: [PixieError].} =