From 7ea0a370135a27398f317b59a599bf377ae140ef Mon Sep 17 00:00:00 2001 From: Ryan Oldenburg Date: Mon, 31 May 2021 20:41:03 -0500 Subject: [PATCH] morepretty --- examples/realtime_win32.nim | 22 ++++++++++++++++------ examples/realtime_wnim.nim | 2 +- src/pixie/demo.nim | 8 ++------ src/pixie/fonts.nim | 14 +++++++------- tests/fuzz_leaks2.nim | 2 +- tests/fuzz_leaks3.nim | 4 ++-- tests/test_context.nim | 26 +++++++++++++------------- 7 files changed, 42 insertions(+), 36 deletions(-) diff --git a/examples/realtime_win32.nim b/examples/realtime_win32.nim index d4c2d9c..1148b22 100644 --- a/examples/realtime_win32.nim +++ b/examples/realtime_win32.nim @@ -108,16 +108,26 @@ proc main() = # Figure out the right size of the window we want. var rect: lean.RECT - rect.left = 0 - rect.top = 0 - rect.right = w + rect.left = 0 + rect.top = 0 + rect.right = w rect.bottom = h AdjustWindowRectEx(cast[LPRECT](rect.addr), WS_OVERLAPPEDWINDOW, 0, 0) # Open the window. - hwnd = CreateWindow(appName, "Win32/Pixie", WS_OVERLAPPEDWINDOW, - CW_USEDEFAULT, CW_USEDEFAULT, rect.right - rect.left, rect.bottom - rect.top, - 0, 0, hInstance, nil) + hwnd = CreateWindow( + appName, + "Win32/Pixie", + WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, + CW_USEDEFAULT, + rect.right - rect.left, + rect.bottom - rect.top, + 0, + 0, + hInstance, + nil + ) ShowWindow(hwnd, SW_SHOW) UpdateWindow(hwnd) diff --git a/examples/realtime_wnim.nim b/examples/realtime_wnim.nim index acea7b2..04155a1 100644 --- a/examples/realtime_wnim.nim +++ b/examples/realtime_wnim.nim @@ -1,4 +1,4 @@ -import pixie, wNim/[wApp, wFrame, wPaintDC, wImage] +import pixie, wFrame, wImage], wNim/[wApp, wPaintDC let w = 256 diff --git a/src/pixie/demo.nim b/src/pixie/demo.nim index a94a23d..7520da8 100644 --- a/src/pixie/demo.nim +++ b/src/pixie/demo.nim @@ -1,10 +1,6 @@ -import opengl, pixie, pixie/context +import opengl, pixie, pixie/context, staticglfw except Image -export pixie - -import staticglfw except Image - -export staticglfw except Image +export pixie, staticglfw except Image var dpi: float32 = 1.0 diff --git a/src/pixie/fonts.nim b/src/pixie/fonts.nim index a322ea9..6acb8ac 100644 --- a/src/pixie/fonts.nim +++ b/src/pixie/fonts.nim @@ -18,8 +18,8 @@ type lineHeight*: float32 ## The line height in pixels or AutoLineHeight for the font's default line height. paint*: Paint textCase*: TextCase - underline*: bool ## Apply an underline. - strikethrough*: bool ## Apply a strikethrough. + underline*: bool ## Apply an underline. + strikethrough*: bool ## Apply a strikethrough. noKerningAdjustments*: bool ## Optionally disable kerning pair adjustments Span* = ref object @@ -27,11 +27,11 @@ type font*: Font Arrangement* = ref object - lines*: seq[(int, int)] ## The (start, stop) of the lines of text. - spans*: seq[(int, int)] ## The (start, stop) of the spans in the text. - fonts*: seq[Font] ## The font for each span. - runes*: seq[Rune] ## The runes of the text. - positions*: seq[Vec2] ## The positions of the glyphs for each rune. + lines*: seq[(int, int)] ## The (start, stop) of the lines of text. + spans*: seq[(int, int)] ## The (start, stop) of the spans in the text. + fonts*: seq[Font] ## The font for each span. + runes*: seq[Rune] ## The runes of the text. + positions*: seq[Vec2] ## The positions of the glyphs for each rune. selectionRects*: seq[Rect] ## The selection rects for each glyph. HAlignMode* = enum diff --git a/tests/fuzz_leaks2.nim b/tests/fuzz_leaks2.nim index b9a0570..8458d4f 100644 --- a/tests/fuzz_leaks2.nim +++ b/tests/fuzz_leaks2.nim @@ -1,4 +1,4 @@ -import pixie, random, os +import os, pixie, random when not defined(pixieLeakCheck): quit("Requires -d:pixieLeakCheck") diff --git a/tests/fuzz_leaks3.nim b/tests/fuzz_leaks3.nim index 4834b42..7c4949c 100644 --- a/tests/fuzz_leaks3.nim +++ b/tests/fuzz_leaks3.nim @@ -1,4 +1,4 @@ -import pixie, random, pixie/fileformats/svg +import pixie, pixie/fileformats/svg, random when not defined(pixieLeakCheck): quit("Requires -d:pixieLeakCheck") @@ -8,7 +8,7 @@ randomize() let data = readFile("tests/images/svg/Ghostscript_Tiger.svg") for i in 0 ..< 100_000: - var image = decodeSvg(data, rand(300 .. 1800), rand(30 .. 1800)) + var image = decodeSvg(data, rand(300 .. 1800), rand(30 .. 1800)) # image.writeFile("tests/fuzz_leaks3.png") # break diff --git a/tests/test_context.nim b/tests/test_context.nim index 49c0437..cfcf523 100644 --- a/tests/test_context.nim +++ b/tests/test_context.nim @@ -499,20 +499,20 @@ block: var y = 15.float32 proc drawDashedLine(pattern: seq[float32]) = - ctx.beginPath(); - ctx.setLineDash(pattern); - ctx.moveTo(0, y); - ctx.lineTo(300, y); - ctx.stroke(); - y += 20; + ctx.beginPath() + ctx.setLineDash(pattern) + ctx.moveTo(0, y) + ctx.lineTo(300, y) + ctx.stroke() + y += 20 - drawDashedLine(@[]); - drawDashedLine(@[1.float32, 1]); - drawDashedLine(@[10.float32, 10]); - drawDashedLine(@[20.float32, 5]); - drawDashedLine(@[15.float32, 3, 3, 3]); - drawDashedLine(@[20.float32, 3, 3, 3, 3, 3, 3, 3]); - drawDashedLine(@[12.float32, 3, 3]); + drawDashedLine(@[]) + drawDashedLine(@[1.float32, 1]) + drawDashedLine(@[10.float32, 10]) + drawDashedLine(@[20.float32, 5]) + drawDashedLine(@[15.float32, 3, 3, 3]) + drawDashedLine(@[20.float32, 3, 3, 3, 3, 3, 3, 3]) + drawDashedLine(@[12.float32, 3, 3]) image.writeFile("tests/images/context/setLineDash_1.png")