static void pdf_filter_q(pdf_csi *csi, void *state_) { pdf_filter_state *state = (pdf_filter_state *)state_; filter_push(csi, state); }
static void rwand_update_state_running(struct rwand_dev *dev, struct rwand_status *new_status) { int new_filtered_period; /* We want the works */ rwand_ensure_mode(dev, new_status, RWAND_MODE_STALL_DETECT | RWAND_MODE_ENABLE_SYNC | RWAND_MODE_ENABLE_COIL | RWAND_MODE_ENABLE_DISPLAY); /* If our display just turned off, the firmware detected a stall. Go back * to the 'starting' state and give up this. */ if ((dev->status.mode & RWAND_MODE_ENABLE_DISPLAY) && !(new_status->mode & RWAND_MODE_ENABLE_DISPLAY)) { rwand_enter_state_starting(dev); return; } /* If our mode has changed, both force a timing update and reset the period filter */ if (new_status->mode != dev->status.mode) { dev->settings_dirty = 1; filter_reset(&dev->period_filter); } new_filtered_period = filter_push(&dev->period_filter, new_status->period); /* Only actually update the timings if our filtered period is noticeably * different than the last set period. This is mainly here to reduce * the bus bandwidth used by all the rwand_nb_request()s below when possible. */ if (abs(new_filtered_period - dev->filtered_period) > PERIOD_TOLERANCE) { dev->settings_dirty = 1; dev->filtered_period = new_filtered_period; } if (dev->settings_dirty) { struct rwand_timings timings; rwand_calc_timings(&dev->settings, new_filtered_period, &timings); rwand_nb_request(dev, RWAND_CTRL_SET_COIL_PHASE, timings.coil_begin, timings.coil_end); rwand_nb_request(dev, RWAND_CTRL_SET_COLUMN_WIDTH, timings.column_width, timings.gap_width); rwand_nb_request(dev, RWAND_CTRL_SET_DISPLAY_PHASE, timings.fwd_phase, timings.rev_phase); rwand_nb_request(dev, RWAND_CTRL_SET_NUM_COLUMNS, dev->settings.num_columns, 0); dev->settings_dirty = 0; } }
/* We never allow the topmost gstate to be changed. This allows us * to pop back to the zeroth level and be sure that our gstate is * sane. This is important for being able to add new operators at * the end of pages in a sane way. */ static filter_gstate * gstate_to_update(pdf_csi *csi, pdf_filter_state *state) { filter_gstate *gstate = state->gstate; /* If we're not the top, that's fine */ if (gstate->next != NULL) return gstate; /* We are the top. Push a group, so we're not */ filter_push(csi, state); gstate = state->gstate; gstate->pushed = 1; call_op(csi, state, PDF_OP_q); return state->gstate; }
/* We never allow the topmost gstate to be changed. This allows us * to pop back to the zeroth level and be sure that our gstate is * sane. This is important for being able to add new operators at * the end of pages in a sane way. */ static filter_gstate * gstate_to_update(fz_context *ctx, pdf_filter_processor *p) { filter_gstate *gstate = p->gstate; /* If we're not the top, that's fine */ if (gstate->next != NULL) return gstate; /* We are the top. Push a group, so we're not */ filter_push(ctx, p); gstate = p->gstate; gstate->pushed = 1; if (p->chain->op_q) p->chain->op_q(ctx, p->chain); return p->gstate; }
static void pdf_filter_q(fz_context *ctx, pdf_processor *proc) { pdf_filter_processor *p = (pdf_filter_processor*)proc; filter_push(ctx, p); }