Lines Matching defs:pself

107 static SANE_Status Source_init (Source *pself,
115 pself->pss = pss;
116 pself->remaining = remaining;
117 pself->bytesPerLine = bytesPerLine;
118 pself->pixelsPerLine = pixelsPerLine;
119 pself->get = get;
120 pself->done = done;
126 static SANE_Int Source_bytesPerLine (Source *pself)
128 return pself->pss->bytes_per_line;
131 static SANE_Int Source_pixelsPerLine (Source *pself)
133 return pself->pss->pixels_per_line;
155 static SANE_Int SCSISource_remaining (Source *pself)
157 SCSISource *ps = (SCSISource *) pself;
161 static SANE_Status SCSISource_get (Source *pself,
165 SCSISource *ps = (SCSISource *) pself;
172 && pself->remaining(pself) > 0
204 static SANE_Status SCSISource_done (Source *pself)
207 UNREFERENCED_PARAMETER(pself);
211 static SANE_Status SCSISource_init (SCSISource *pself, SnapScan_Scanner *pss)
213 SANE_Status status = Source_init ((Source *) pself, pss,
221 pself->scsi_buf_max = 0;
222 pself->scsi_buf_pos = 0;
223 pself->absolute_max =
238 static SANE_Int FDSource_remaining (Source *pself)
240 FDSource *ps = (FDSource *) pself;
244 static SANE_Status FDSource_get (Source *pself, SANE_Byte *pbuf, SANE_Int *plen)
247 FDSource *ps = (FDSource *) pself;
251 && pself->remaining(pself) > 0
281 static SANE_Status FDSource_done (Source *pself)
283 close(((FDSource *) pself)->fd);
287 static SANE_Status FDSource_init (FDSource *pself,
291 SANE_Status status = Source_init ((Source *) pself,
300 pself->fd = fd;
301 pself->bytes_remaining = pss->bytes_per_line * (pss->lines + pss->chroma);
319 static SANE_Int BufSource_remaining (Source *pself)
321 BufSource *ps = (BufSource *) pself;
325 static SANE_Status BufSource_get (Source *pself,
329 BufSource *ps = (BufSource *) pself;
331 SANE_Int to_move = MIN(*plen, pself->remaining(pself));
345 static SANE_Status BufSource_done (Source *pself)
347 UNREFERENCED_PARAMETER(pself);
351 static SANE_Status BufSource_init (BufSource *pself,
356 SANE_Status status = Source_init ((Source *) pself,
366 pself->buf = buf;
367 pself->buf_size = buf_size;
368 pself->buf_pos = 0;
442 static SANE_Int TxSource_remaining (Source *pself)
444 TxSource *ps = (TxSource *) pself;
448 static SANE_Int TxSource_bytesPerLine (Source *pself)
450 TxSource *ps = (TxSource *) pself;
454 static SANE_Int TxSource_pixelsPerLine (Source *pself)
456 TxSource *ps = (TxSource *) pself;
460 static SANE_Status TxSource_get (Source *pself, SANE_Byte *pbuf, SANE_Int *plen)
462 TxSource *ps = (TxSource *) pself;
466 static SANE_Status TxSource_done (Source *pself)
468 TxSource *ps = (TxSource *) pself;
475 static SANE_Status TxSource_init (TxSource *pself,
484 SANE_Status status = Source_init((Source *) pself,
492 pself->psub = psub;
511 static SANE_Int Expander_remaining (Source *pself)
513 Expander *ps = (Expander *) pself;
514 SANE_Int sub_remaining = TxSource_remaining(pself);
515 SANE_Int sub_bits_per_channel = TxSource_pixelsPerLine(pself);
528 static SANE_Int Expander_bytesPerLine (Source *pself)
530 return TxSource_pixelsPerLine(pself)*3;
533 static SANE_Status Expander_get (Source *pself, SANE_Byte *pbuf, SANE_Int *plen)
535 Expander *ps = (Expander *) pself;
541 pself->remaining(pself) > 0 &&
555 status = TxSource_get(pself, ps->ch_buf + ps->ch_pos, &ndata);
590 static SANE_Status Expander_done (Source *pself)
592 Expander *ps = (Expander *) pself;
593 SANE_Status status = TxSource_done(pself);
601 static SANE_Status Expander_init (Expander *pself,
605 SANE_Status status = TxSource_init((TxSource *) pself,
615 pself->ch_size = TxSource_bytesPerLine((Source *) pself)/3;
616 pself->ch_buf = (SANE_Byte *) malloc(pself->ch_size);
617 if (pself->ch_buf == NULL)
626 pself->ch_ndata = 0;
627 pself->ch_pos = 0;
628 pself->last_last_bit = pself->pixelsPerLine((Source *) pself)%8;
629 if (pself->last_last_bit == 0)
630 pself->last_last_bit = 7;
631 pself->last_last_bit = 7 - pself->last_last_bit;
632 pself->bit = 7;
633 if (pself->ch_size > 1)
634 pself->last_bit = 0;
636 pself->last_bit = pself->last_last_bit;
694 static SANE_Int Deinterlacer_remaining (Source *pself)
696 Deinterlacer *ps = (Deinterlacer *) pself;
697 SANE_Int result = TxSource_remaining(pself);
702 static SANE_Status Deinterlacer_get (Source *pself, SANE_Byte *pbuf, SANE_Int *plen)
704 Deinterlacer *ps = (Deinterlacer *) pself;
710 DBG(DL_DATA_TRACE, "%s: remaining=%d, pself->remaining=%d, ch_ndata=%d, ch_pos=%d\n",
711 me, remaining, pself->remaining(pself), ps->ch_ndata, ps->ch_pos);
715 pself->remaining(pself) > 0 &&
730 status = TxSource_get(pself, ps->ch_buf + ps->ch_pos, &ndata);
814 pself->remaining(pself),
816 TxSource_remaining(pself),
821 static SANE_Status Deinterlacer_done (Source *pself)
823 Deinterlacer *ps = (Deinterlacer *) pself;
824 SANE_Status status = TxSource_done(pself);
833 static SANE_Status Deinterlacer_init (Deinterlacer *pself,
837 SANE_Status status = TxSource_init((TxSource *) pself,
847 pself->ch_shift_even = SANE_TRUE;
851 pself->ch_offset = 8;
853 pself->ch_shift_even = SANE_FALSE;
857 pself->ch_offset = 4;
860 pself->ch_line_size = TxSource_bytesPerLine((Source *) pself);
863 pself->ch_size = pself->ch_line_size * (pself->ch_offset + 1);
864 pself->ch_buf = (SANE_Byte *) malloc(pself->ch_size);
865 if (pself->ch_buf == NULL)
874 pself->ch_ndata = 0;
875 pself->ch_pos = 0;
876 pself->ch_past_init = SANE_FALSE;
878 pself->ch_bytes_per_pixel = 1;
880 pself->ch_bytes_per_pixel = 3;
882 pself->ch_bytes_per_pixel *= 2;
884 pself->ch_lineart = (actual_mode(pss) == MD_LINEART);
937 static SANE_Int RGBRouter_remaining (Source *pself)
939 RGBRouter *ps = (RGBRouter *) pself;
942 remaining = TxSource_remaining(pself) - ps->cb_size + ps->cb_line_size;
944 remaining = TxSource_remaining(pself) + ps->cb_line_size - ps->pos;
948 static SANE_Status RGBRouter_get (Source *pself,
952 RGBRouter *ps = (RGBRouter *) pself;
962 while (remaining > 0 && pself->remaining(pself) > 0 && !cancelRead)
964 DBG(DL_DATA_TRACE, "%s: remaining=%d, pself->remaining=%d, round_req=%d, cb_size=%d\n",
965 me, remaining, pself->remaining(pself), ps->round_req, ps->cb_size);
974 status = TxSource_get (pself,
997 if (pself->pss->bpp_scan == 8)
1003 else if (pself->pss->pdev->model == SCANWIT2720S)
1052 pself->remaining(pself),
1054 TxSource_remaining(pself),
1059 static SANE_Status RGBRouter_done (Source *pself)
1061 RGBRouter *ps = (RGBRouter *) pself;
1062 SANE_Status status = TxSource_done(pself);
1072 static SANE_Status RGBRouter_init (RGBRouter *pself,
1076 SANE_Status status = TxSource_init((TxSource *) pself,
1091 pself->cb_line_size = pself->bytesPerLine((Source *) pself);
1092 pself->cb_size = pself->cb_line_size*lines_in_buffer;
1093 pself->pos = pself->cb_line_size;
1095 pself->round_req = pself->cb_size;
1096 pself->round_read = 0;
1098 pself->cbuf = (SANE_Byte *) malloc(pself->cb_size);
1099 pself->xbuf = (SANE_Byte *) malloc(pself->cb_line_size);
1100 if (pself->cbuf == NULL || pself->xbuf == NULL)
1111 pself->cb_start = 0;
1114 pself->ch_offset[ch] =
1115 pss->chroma_offset[ch] * pself->cb_line_size
1116 + ch * (pself->cb_line_size / 3);
1120 pself->cb_line_size, lines_in_buffer, pself->cb_size);
1122 pself->ch_offset[0], pself->ch_offset[1],pself->ch_offset[2]);
1156 static SANE_Status Inverter_get (Source *pself, SANE_Byte *pbuf, SANE_Int *plen)
1158 SANE_Status status = TxSource_get (pself, pbuf, plen);
1168 static SANE_Status Inverter_init (Inverter *pself,
1172 return TxSource_init ((TxSource *) pself,