Skip to content

Commit dcffa29

Browse files
committed
fix(display/bézier): make control points wider to cover whole canvas
perhaps in the future it would be best to specify bounds
1 parent c89d8ca commit dcffa29

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

display/rendering/canvas.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,12 @@ struct line {
3131
struct color c;
3232
};
3333

34-
// TODO: control points are not tight to the bounds of the curve, so either
35-
// 1) explicitly pass bounds, infer i32 control points from that, or
36-
// 2) explicitly pass control points as i32s
3734
struct bezier2 {
38-
uint16_t x0, y0;
39-
uint16_t x1, y1;
40-
uint16_t x2, y2;
35+
// Control points are wider than u16 to allow expressing
36+
// curves across the whole canvas.
37+
int32_t x0, y0;
38+
int32_t x1, y1;
39+
int32_t x2, y2;
4140
struct color c;
4241
};
4342

display/testing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ static void test_bezier2(struct canvas *c)
305305
.x0 = c->width / 4,
306306
.y0 = c->height * 3 / 4,
307307
.x1 = c->width / 2,
308-
.y1 = 0,
308+
.y1 = -c->height / 3,
309309
.x2 = c->width * 3 / 4,
310310
.y2 = c->height * 3 / 4,
311311
.c = FG,

0 commit comments

Comments
 (0)