~ubuntu-branches/debian/squeeze/ghostscript/squeeze

« back to all changes in this revision

Viewing changes to src/gdevprn.c

  • Committer: Bazaar Package Importer
  • Author(s): Masayuki Hatta (mhatta)
  • Date: 2009-01-04 12:09:59 UTC
  • mfrom: (16.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090104120959-m9lbagj775ucg0h3
Tags: 8.63.dfsg.1-2
libgs-dev: put versioned dependency on libgs8 - closes: #510691

Show diffs side-by-side

added added

removed removed

Lines of Context:
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
13
 
14
 
/* $Id: gdevprn.c 8528 2008-02-17 22:32:15Z leonardo $ */
 
14
/* $Id: gdevprn.c 8887 2008-07-28 07:52:42Z leonardo $ */
15
15
/* Generic printer driver support */
16
16
#include "ctype_.h"
17
17
#include "gdevprn.h"
57
57
                                  int old_width, int old_height,
58
58
                                  bool old_page_uses_transparency);
59
59
 
 
60
extern dev_proc_open_device(pattern_clist_open_device);
 
61
 
60
62
/* ------ Open/close ------ */
61
63
 
62
64
/* Open a generic printer device. */
277
279
        memset(ppdev->skip, 0, sizeof(ppdev->skip));
278
280
        size_ok = ppdev->printer_procs.buf_procs.size_buf_device
279
281
            (&buf_space, pdev, NULL, pdev->height, false) >= 0;
 
282
        mem_space = buf_space.bits + buf_space.line_ptrs;
280
283
        if (ppdev->page_uses_transparency) {
281
 
            if (new_height < max_ulong/(ESTIMATED_PDF14_ROW_SPACE(max(1, new_width)) >> 3))
282
 
                pdf14_trans_buffer_size = new_height
283
 
                    * (ESTIMATED_PDF14_ROW_SPACE(new_width) >> 3);
284
 
            else {
 
284
            pdf14_trans_buffer_size = (ESTIMATED_PDF14_ROW_SPACE(max(1, new_width)) >> 3);
 
285
            if (new_height < (max_ulong - mem_space) / pdf14_trans_buffer_size) {
 
286
                pdf14_trans_buffer_size *= new_height;
 
287
                mem_space += pdf14_trans_buffer_size;
 
288
            } else {
285
289
                size_ok = 0;
286
 
                pdf14_trans_buffer_size = 0;
287
290
            }
288
291
        }
289
 
        mem_space = buf_space.bits + buf_space.line_ptrs
290
 
                    + pdf14_trans_buffer_size;
291
292
 
292
293
        /* Compute desired space params: never use the space_params as-is. */
293
294
        /* Rather, give the dev-specific driver a chance to adjust them. */
358
359
 
359
360
            if ( code >= 0 || (reallocate && pass > 1) )
360
361
                ppdev->procs = gs_clist_device_procs;
 
362
            /* 
 
363
             * Now the device is a clist device, we enable multi-threaded rendering.
 
364
             * It will remain enabled, but that doesn't really cause any problems.
 
365
             */
 
366
            clist_enable_multi_thread_render(pdev);
361
367
        } else {
362
368
            /* Render entirely in memory. */
363
369
            gx_device *bdev = (gx_device *)pmemdev;
497
503
        (code = param_write_int(plist, "BandWidth", &ppdev->space_params.band.BandWidth)) < 0 ||
498
504
        (code = param_write_int(plist, "BandHeight", &ppdev->space_params.band.BandHeight)) < 0 ||
499
505
        (code = param_write_long(plist, "BandBufferSpace", &ppdev->space_params.band.BandBufferSpace)) < 0 ||
 
506
        (code = param_write_int(plist, "NumRenderingThreads", &ppdev->num_render_threads_requested)) < 0 ||
500
507
        (code = param_write_bool(plist, "OpenOutputFile", &ppdev->OpenOutputFile)) < 0 ||
501
508
        (code = param_write_bool(plist, "ReopenPerPage", &ppdev->ReopenPerPage)) < 0 ||
502
509
        (code = param_write_bool(plist, "PageUsesTransparency",
542
549
    int duplex_set = -1;
543
550
    int width = pdev->width;
544
551
    int height = pdev->height;
 
552
    int nthreads = ppdev->num_render_threads_requested;
545
553
    gdev_prn_space_params sp, save_sp;
546
554
    gs_param_string ofs;
547
555
    gs_param_dict mdict;
665
673
    read_media("InputAttributes");
666
674
    read_media("OutputAttributes");
667
675
 
 
676
    switch (code = param_read_int(plist, (param_name = "NumRenderingThreads"), &nthreads)) {
 
677
        case 0:
 
678
            break;
 
679
        default:
 
680
            ecode = code;
 
681
            param_signal_error(plist, param_name, ecode);
 
682
        case 1:
 
683
            ;
 
684
    }
 
685
 
668
686
    if (ecode < 0)
669
687
        return ecode;
670
688
    /* Prevent gx_default_put_params from closing the printer. */
682
700
        ppdev->Duplex_set = duplex_set;
683
701
    }
684
702
    ppdev->space_params = sp;
 
703
    ppdev->num_render_threads_requested = nthreads;
685
704
 
686
705
    /* If necessary, free and reallocate the printer memory. */
687
706
    /* Formerly, would not reallocate if device is not open: */