From 76205cff2b8b99768d25fa235379b44dad122bcc Mon Sep 17 00:00:00 2001 From: Benjamin Stigsen Date: Mon, 23 Aug 2021 12:38:29 +0200 Subject: [PATCH] gg: add scaling to draw_convex_poly (#11276) --- vlib/gg/gg.v | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/vlib/gg/gg.v b/vlib/gg/gg.v index ca9c4ee719..ac67b5d4e2 100644 --- a/vlib/gg/gg.v +++ b/vlib/gg/gg.v @@ -640,16 +640,16 @@ pub fn (ctx &Context) draw_convex_poly(points []f32, c gx.Color) { sgl.c4b(c.r, c.g, c.b, c.a) sgl.begin_triangle_strip() - x0 := points[0] - y0 := points[1] + x0 := points[0] * ctx.scale + y0 := points[1] * ctx.scale for i in 1 .. (len / 2 + 1) { sgl.v2f(x0, y0) - sgl.v2f(points[i * 4 - 2], points[i * 4 - 1]) - sgl.v2f(points[i * 4], points[i * 4 + 1]) + sgl.v2f(points[i * 4 - 2] * ctx.scale, points[i * 4 - 1] * ctx.scale) + sgl.v2f(points[i * 4] * ctx.scale, points[i * 4 + 1] * ctx.scale) } if len % 2 == 0 { - sgl.v2f(points[2 * len - 2], points[2 * len - 1]) + sgl.v2f(points[2 * len - 2] * ctx.scale, points[2 * len - 1] * ctx.scale) } sgl.end() }