/* We know ppath != ppath_old. */ int gx_path_copy_reversed(const gx_path *ppath_old, gx_path *ppath, int init) { const subpath *psub = ppath_old->first_subpath; #ifdef DEBUG if ( gs_debug['p'] ) gx_dump_path(ppath_old, "before reversepath"); #endif if ( init ) gx_path_init(ppath, &ppath_old->memory_procs); nsp: while ( psub ) { const segment *pseg = psub->last; const segment *prev; int code = gx_path_add_point(ppath, pseg->pt.x, pseg->pt.y); if ( code < 0 ) { gx_path_release(ppath); return code; } for ( ; ; pseg = prev ) { prev = pseg->prev; switch ( pseg->type ) { case s_start: /* Finished subpath */ if ( psub->closed ) code = gx_path_close_subpath(ppath); psub = (const subpath *)psub->last->next; goto nsp; case s_curve: { const curve_segment *pc = (const curve_segment *)pseg; code = gx_path_add_curve(ppath, pc->p2.x, pc->p2.y, pc->p1.x, pc->p1.y, prev->pt.x, prev->pt.y); break; } case s_line: case s_line_close: code = gx_path_add_line(ppath, prev->pt.x, prev->pt.y); break; } if ( code ) { gx_path_release(ppath); return code; } } /* not reached */ } ppath->position = ppath_old->position; /* restore current point */ #ifdef DEBUG if ( gs_debug['p'] ) gx_dump_path(ppath, "after reversepath"); #endif return 0; }
static inline int gs_curveto_aux(gs_state * pgs, floatp x1, floatp y1, floatp x2, floatp y2, floatp x3, floatp y3) { gs_fixed_point p1, p2, p3; int code; gx_path *ppath = pgs->path; code = clamp_point_aux(pgs->clamp_coordinates, &p1, x1, y1); if (code < 0) return code; code = clamp_point_aux(pgs->clamp_coordinates, &p2, x2, y2); if (code < 0) return code; code = clamp_point_aux(pgs->clamp_coordinates, &p3, x3, y3); if (code < 0) return code; code = gx_path_add_curve(ppath, p1.x, p1.y, p2.x, p2.y, p3.x, p3.y); if (code < 0) return code; gx_setcurrentpoint(pgs, x3, y3); return 0; }