diff options
Diffstat (limited to 'app/cornu/bezctx_xtrkcad.c')
-rw-r--r-- | app/cornu/bezctx_xtrkcad.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/app/cornu/bezctx_xtrkcad.c b/app/cornu/bezctx_xtrkcad.c index 778e7dd..2e0d8f4 100644 --- a/app/cornu/bezctx_xtrkcad.c +++ b/app/cornu/bezctx_xtrkcad.c @@ -72,19 +72,16 @@ bezctx_xtrkcad_lineto(bezctx *z, double x, double y) { return; } DYNARR_APPEND(trkSeg_t,* bc->segsArray,10); - trkSeg_p seg = &trkSeg(bc->segsArray->cnt-1); + trkSeg_p seg = &DYNARR_LAST( trkSeg_t, *bc->segsArray); seg->u.l.pos[0].x = bc->last_pos.x; seg->u.l.pos[0].y = bc->last_pos.y; seg->u.l.pos[1].x = x; seg->u.l.pos[1].y = y; seg->u.l.option = 0; - seg->width = 0.0; + seg->lineWidth = 0.0; seg->color = wDrawColorBlack; seg->type = SEG_STRTRK; - if (seg->bezSegs.ptr) MyFree(seg->bezSegs.ptr); - seg->bezSegs.max =0; - seg->bezSegs.cnt = 0; - seg->bezSegs.ptr = NULL; + DYNARR_FREE( trkSeg_t, seg->bezSegs ); seg->u.l.angle = FindAngle(seg->u.l.pos[0],seg->u.l.pos[1]); bc->last_pos.x = x; bc->last_pos.y = y; @@ -106,7 +103,7 @@ bezctx_xtrkcad_quadto(bezctx *z, double x1, double y1, double x2, double y2) return; } DYNARR_APPEND(trkSeg_t,* bc->segsArray,10); - trkSeg_p seg = &trkSeg(bc->segsArray->cnt-1); + trkSeg_p seg = &DYNARR_LAST( trkSeg_t, *bc->segsArray); seg->u.b.pos[0] = bc->last_pos; seg->u.b.pos[1].x = x1; seg->u.b.pos[1].y = y1; @@ -114,13 +111,10 @@ bezctx_xtrkcad_quadto(bezctx *z, double x1, double y1, double x2, double y2) seg->u.b.pos[2].y = y1; seg->u.b.pos[3].x = x2; seg->u.b.pos[3].y = y2; - seg->width = 0.0; + seg->lineWidth = 0.0; seg->color = wDrawColorBlack; seg->type = SEG_BEZTRK; - if (seg->bezSegs.ptr) MyFree(seg->bezSegs.ptr); - seg->bezSegs.max =0; - seg->bezSegs.cnt = 0; - seg->bezSegs.ptr = NULL; + DYNARR_FREE( trkSeg_t, seg->bezSegs ); bc->last_pos.x = x2; bc->last_pos.y = y2; @@ -143,7 +137,7 @@ static void return; } DYNARR_APPEND(trkSeg_t,* bc->segsArray,10); - trkSeg_p seg = &trkSeg(bc->segsArray->cnt-1); + trkSeg_p seg = &DYNARR_LAST(trkSeg_t, *bc->segsArray); seg->u.b.pos[0].x = bc->last_pos.x; seg->u.b.pos[0].y = bc->last_pos.y; seg->u.b.pos[1].x = x1; @@ -152,13 +146,10 @@ static void seg->u.b.pos[2].y = y2; seg->u.b.pos[3].x = x3; seg->u.b.pos[3].y = y3; - seg->width = 0.0; + seg->lineWidth = 0.0; seg->color = wDrawColorBlack; seg->type = SEG_BEZTRK; - if (seg->bezSegs.ptr) MyFree(seg->bezSegs.ptr); - seg->bezSegs.max = 0; - seg->bezSegs.cnt = 0; - seg->bezSegs.ptr = NULL; + DYNARR_FREE( trkSegs_t, seg->bezSegs ); bc->last_pos.x = x3; bc->last_pos.y = y3; @@ -166,12 +157,12 @@ static void if (bc->draw_spots) { DYNARR_APPEND(trkSeg_t,* bc->segsArray,10); - seg = &trkSeg(bc->segsArray->cnt-1); + seg = &DYNARR_LAST( trkSeg_t, *bc->segsArray ); seg->type=SEG_FILCRCL; seg->u.c.center.x = bc->last_pos.x; seg->u.c.center.y = bc->last_pos.y; seg->u.c.radius = bc->spot_size; - seg->width = 0.0; + seg->lineWidth = 0.0; seg->color = wDrawColorGrey40; } @@ -208,9 +199,7 @@ new_bezctx_xtrkcad(dynArr_t * segArray, int ends[2], BOOL_T spots, DIST_T spot_s result->spot_size = spot_size; result->track = TRUE; - result->segsArray->cnt =0; - result->segsArray->ptr =0; - result->segsArray->max =0; + DYNARR_INIT( trkSeg_t, *result->segsArray ); return &result->base; |