~ubuntu-branches/ubuntu/saucy/sane-backends/saucy

« back to all changes in this revision

Viewing changes to backend/pixma.c

  • Committer: Bazaar Package Importer
  • Author(s): Robert Ancell
  • Date: 2011-02-14 14:28:56 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110214142856-6gxjetg88q9zctid
Tags: 1.0.22-0ubuntu1
* New upstream release
* debian/control:
  - Use standards version 3.9.1
* debian/patches/allow_dll.d_symlinks.patch:
* debian/patches/fix_epson2_cancel.patch:
* debian/patches/fix_epson2_commands.patch:
* debian/patches/fix_xerox_mfp_color_mode.patch:
* debian/patches/genesys_disable_raw_data_log.patch:
* debian/patches/no_translations.patch:
* debian/patches/saned_exit_avahi_process.patch:
* debian/patches/scsi_perfection_2450.patch:
* debian/patches/scsi_scanjet_4c.patch:
* debian/patches/xerox_mfp_new_ids.patch:
  - Applied upstream
* debian/watch:
  - Dropped, the URL is not consistent between releases

Show diffs side-by-side

added added

removed removed

Lines of Context:
102
102
  option_descriptor_t opt[opt_last];
103
103
  SANE_Range xrange, yrange;
104
104
  SANE_Word dpi_list[9];        /* up to 9600 dpi */
105
 
  SANE_String_Const mode_list[3];
 
105
  SANE_String_Const mode_list[4];
106
106
  uint8_t gamma_table[4096];
107
107
  SANE_String_Const source_list[4];
108
108
  pixma_paper_source_t source_map[4];
109
109
 
110
110
  unsigned byte_pos_in_line, output_line_size;
111
 
  unsigned image_bytes_read;
 
111
  uint64_t image_bytes_read;
112
112
  unsigned page_count;          /* valid for ADF */
113
113
 
114
114
  SANE_Pid reader_taskid;
556
556
print_scan_param (int level, const pixma_scan_param_t * sp)
557
557
{
558
558
  pixma_dbg (level, "Scan parameters\n");
559
 
  pixma_dbg (level, "  line_size=%u image_size=%u channels=%u depth=%u\n",
 
559
  pixma_dbg (level, "  line_size=%u image_size=%"PRIu64" channels=%u depth=%u\n",
560
560
             sp->line_size, sp->image_size, sp->channels, sp->depth);
561
561
  pixma_dbg (level, "  dpi=%ux%u offset=(%u,%u) dimension=%ux%u\n",
562
562
             sp->xdpi, sp->ydpi, sp->x, sp->y, sp->w, sp->h);
574
574
  memset (sp, 0, sizeof (*sp));
575
575
 
576
576
  sp->channels = (OVAL (opt_mode).w == 0) ? 3 : 1;
 
577
  sp->depth = (OVAL (opt_mode).w == 2) ? 1 : 8;
577
578
  sp->xdpi = sp->ydpi = OVAL (opt_resolution).w;
578
579
 
579
580
#define PIXEL(x,dpi) (int)((SANE_UNFIX(x) / 25.4 * (dpi)) + 0.5)
653
654
      ss->mode_list[1] = SANE_VALUE_SCAN_MODE_GRAY;
654
655
    }
655
656
 
 
657
  if (cfg->cap & PIXMA_CAP_LINEART)
 
658
    {
 
659
      ss->mode_list[2] = SANE_VALUE_SCAN_MODE_LINEART;
 
660
    }
 
661
 
656
662
  /* setup paper source */
657
663
  i = 0;
658
664
  ss->source_list[i] = SANE_I18N ("Flatbed");
988
994
    }
989
995
  else if (count == 0)
990
996
    {
991
 
      PDBG (pixma_dbg (3, "read_image():reader task closed the pipe:"
992
 
                       "%u bytes received, %u bytes expected\n",
 
997
      PDBG (pixma_dbg (3, "read_image():reader task closed the pipe:%"
 
998
                       PRIu64" bytes received, %"PRIu64" bytes expected\n",
993
999
                       ss->image_bytes_read, ss->sp.image_size));
994
1000
      close (ss->rpipe);
995
1001
      ss->rpipe = -1;
1252
1258
  p->depth = sp->depth;
1253
1259
  p->pixels_per_line = sp->w;
1254
1260
  /* p->bytes_per_line = sp->line_size; NOTE: It should work this way, but it doesn't. No SANE frontend can cope with this. */
1255
 
  p->bytes_per_line = sp->w * sp->channels * (sp->depth / 8);
 
1261
  p->bytes_per_line = (sp->w * sp->channels * sp->depth) / 8;
1256
1262
  return SANE_STATUS_GOOD;
1257
1263
}
1258
1264
 
1287
1293
  error = start_reader_task (ss);
1288
1294
  if (error >= 0)
1289
1295
    {
1290
 
      ss->output_line_size = ss->sp.w * ss->sp.channels * (ss->sp.depth / 8);
 
1296
      ss->output_line_size = (ss->sp.w * ss->sp.channels * ss->sp.depth) / 8;
1291
1297
      ss->byte_pos_in_line = 0;
1292
1298
      ss->last_read_status = SANE_STATUS_GOOD;
1293
1299
      ss->scanning = SANE_TRUE;
1301
1307
{
1302
1308
  DECL_CTX;
1303
1309
  int sum, n;
1304
 
  SANE_Byte temp[60];
 
1310
  /* Due to 32 pixels alignment, sizeof(temp) is to be greater than:
 
1311
   * max(nchannels) * max (sp.line_size - output_line_size)
 
1312
   * so currently: 3 * 32 = 96  for better end line cropping efficiency */
 
1313
  SANE_Byte temp[100];
1305
1314
  SANE_Status status;
1306
1315
 
1307
1316
  if (len)