Skip to content

Commit

Permalink
gg: fix overlapping slices in draw_slice_filled() (#20182)
Browse files Browse the repository at this point in the history
  • Loading branch information
Larpon committed Dec 15, 2023
1 parent 6e47782 commit 6d0d82d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 5 additions & 4 deletions examples/gg/arcs_and_slices.v
Expand Up @@ -7,7 +7,10 @@ import math
const win_width = 700
const win_height = 800
const bg_color = gx.white
const colour = gx.black

// A transparent color is used to aid in verifying that
// rendering is precise on each of the the arc types (e.g. no overlapping or double rendered slices)
const colour = gx.rgba(100, 100, 0, 100)

enum Selection {
segs = 0
Expand All @@ -28,9 +31,7 @@ mut:
}

fn main() {
mut app := &App{
gg: 0
}
mut app := &App{}
app.gg = gg.new_context(
width: win_width
height: win_height
Expand Down
4 changes: 1 addition & 3 deletions vlib/gg/draw.c.v
Expand Up @@ -727,9 +727,7 @@ pub fn (ctx &Context) draw_slice_filled(x f32, y f32, radius f32, start_angle f3
xx *= rad_factor
yy *= rad_factor
sgl.v2f(xx + nx, yy + ny)
if i & 1 == 0 {
sgl.v2f(nx, ny)
}
sgl.v2f(nx, ny)
}
sgl.end()
}
Expand Down

0 comments on commit 6d0d82d

Please sign in to comment.