static int test4(gs_state * pgs, gs_memory_t * mem) { gs_c_param_list list; float resv[2]; gs_param_float_array ares; int code; gx_device *dev = gs_currentdevice(pgs); gs_c_param_list_write(&list, mem); resv[0] = resv[1] = 100; ares.data = resv; ares.size = 2; ares.persistent = true; code = param_write_float_array((gs_param_list *) & list, "HWResolution", &ares); if (code < 0) { lprintf1("Writing HWResolution failed: %d\n", code); gs_abort(mem); } gs_c_param_list_read(&list); code = gs_putdeviceparams(dev, (gs_param_list *) & list); gs_c_param_list_release(&list); if (code < 0) { lprintf1("Setting HWResolution failed: %d\n", code); gs_abort(mem); } gs_initmatrix(pgs); gs_initclip(pgs); if (code == 1) { code = (*dev_proc(dev, open_device)) (dev); if (code < 0) { lprintf1("Reopening device failed: %d\n", code); gs_abort(mem); } } gs_moveto(pgs, 0.0, 72.0); gs_rlineto(pgs, 72.0, 0.0); gs_rlineto(pgs, 0.0, 72.0); gs_closepath(pgs); gs_stroke(pgs); return 0; }
/* Accumulate successive segments in the same direction. */ static int add_dxdy(register status * out, int dx, int dy, int count) { if (count != 0) { if (dx == out->dx && dy == out->dy) out->count += count; else { if (out->count != 0) { int code = gs_rlineto(out->pgs, out->dx * out->count / (float)outline_scale, out->dy * out->count / (float)outline_scale); if (code < 0) return code; } out->dx = dx, out->dy = dy; out->count = count; } } return 0; }