Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gg: fix overlapping slices in draw_slice_filled() #20182

Merged
merged 2 commits into from
Dec 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions examples/gg/arcs_and_slices.v
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Loading