void pcl_mark_page_for_current_pos(pcl_state_t * pcs) { /* nothing to do */ if (pcs->page_marked) return; /* convert current point to device space and check if it is inside device rectangle for the page */ { gs_fixed_rect page_box; gs_fixed_point pt; int code; code = gx_default_clip_box(pcs->pgs, &page_box); if (code < 0) /* shouldn't happen. */ return; code = gx_path_current_point(gx_current_path(pcs->pgs), &pt); if (code < 0) /* shouldn't happen */ return; /* half-open lower - not sure this is correct */ if (pt.x >= page_box.p.x && pt.y >= page_box.p.y && pt.x < page_box.q.x && pt.y < page_box.q.y) pcs->page_marked = true; } }
int gs_initclip(gs_state * pgs) { gs_fixed_rect box; int code = gx_default_clip_box(pgs, &box); if (code < 0) return code; return gx_clip_to_rectangle(pgs, &box); }
int gs_viewclippath(gs_state * pgs) { gx_path cpath; gx_clip_path *pcpath = pgs->view_clip; int code; gx_path_init_local(&cpath, pgs->memory); if (pcpath == 0 || pcpath->rule == 0) { /* No view clip path is active: fabricate one. */ gs_fixed_rect box; code = gx_default_clip_box(pgs, &box); if (code < 0) return code; code = gx_path_add_rectangle(&cpath, box.p.x, box.p.y, box.q.x, box.q.y); } else { code = gx_cpath_to_path(pcpath, &cpath); } if (code < 0) return code; return gx_path_assign_free(pgs->path, &cpath); }