From 22214c73e35a63341848ef6d14b462e85d7f500e Mon Sep 17 00:00:00 2001 From: KJ Lawrence Date: Sat, 19 Jun 2021 02:07:34 -0400 Subject: [PATCH] gg: apply ctx.scale to circle pos (#10512) --- vlib/gg/gg.v | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index a7ccfa7f1b..28d7a0e86f 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -444,15 +444,18 @@ pub fn (ctx &Context) draw_circle_line(x f32, y f32, r int, segments int, c gx.C sgl.load_pipeline(ctx.timage_pip) } sgl.c4b(c.r, c.g, c.b, c.a) + nx := x * ctx.scale + ny := y * ctx.scale + nr := r * ctx.scale mut theta := f32(0) mut xx := f32(0) mut yy := f32(0) sgl.begin_line_strip() for i := 0; i < segments + 1; i++ { theta = 2.0 * f32(math.pi) * f32(i) / f32(segments) - xx = r * math.cosf(theta) - yy = r * math.sinf(theta) - sgl.v2f(xx + x, yy + y) + xx = nr * math.cosf(theta) + yy = nr * math.sinf(theta) + sgl.v2f(xx + nx, yy + ny) } sgl.end() }