Skip to content

Commit 6d0d82d

Browse files
authored
gg: fix overlapping slices in draw_slice_filled() (#20182)
1 parent 6e47782 commit 6d0d82d

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

examples/gg/arcs_and_slices.v

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@ import math
77
const win_width = 700
88
const win_height = 800
99
const bg_color = gx.white
10-
const colour = gx.black
10+
11+
// A transparent color is used to aid in verifying that
12+
// rendering is precise on each of the the arc types (e.g. no overlapping or double rendered slices)
13+
const colour = gx.rgba(100, 100, 0, 100)
1114

1215
enum Selection {
1316
segs = 0
@@ -28,9 +31,7 @@ mut:
2831
}
2932

3033
fn main() {
31-
mut app := &App{
32-
gg: 0
33-
}
34+
mut app := &App{}
3435
app.gg = gg.new_context(
3536
width: win_width
3637
height: win_height

vlib/gg/draw.c.v

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,7 @@ pub fn (ctx &Context) draw_slice_filled(x f32, y f32, radius f32, start_angle f3
727727
xx *= rad_factor
728728
yy *= rad_factor
729729
sgl.v2f(xx + nx, yy + ny)
730-
if i & 1 == 0 {
731-
sgl.v2f(nx, ny)
732-
}
730+
sgl.v2f(nx, ny)
733731
}
734732
sgl.end()
735733
}

0 commit comments

Comments
 (0)