~ubuntu-branches/ubuntu/vivid/ghostscript/vivid-security

« back to all changes in this revision

Viewing changes to devices/gdev4081.c

  • Committer: Package Import Robot
  • Author(s): Till Kamppeter
  • Date: 2013-08-09 20:01:36 UTC
  • mfrom: (1.1.37)
  • Revision ID: package-import@ubuntu.com-20130809200136-amb6zrr7hnjb5jq9
Tags: 9.08~rc1~dfsg-0ubuntu1
* New upstream release
   - Ghostscript 9.08rc1.
   - We are using the system's liblcms2 and libopenjpeg now.
* debian/patches/020130401-852e545-pxl-xl-driver-produced-drawing-commands-without-setting-color-space.patch:
  Removed patch backported from upstream.
* debian/patches/ojdk-8007925+8007926.patch,
  debian/patches/ojdk-8007927.patch,
  debian/patches/ojdk-8007929.patch,
  debian/patches/ojdk-8009654.patch: Removed patches on build in liblcms2, we
  use the system's liblcms2 now.
* debian/patches/2001_docdir_fix_for_debian.patch: Manually updated to new
  upstream source code.
* debian/patches/2003_support_multiarch.patch: Refreshed with quilt.
* debian/control: Added build dependencies on liblcms2-dev and
  libopenjpeg-dev.
* debian/rules: Check for removed lcms2/ and openjpeg/ subdirectories in
  the repackaging check again, also set build options for shared liblcms2
  and libopenjpeg libraries.
* debian/rules: Makefile.in and configure.ac are in the root directory of
  the source now and do not need to get linked from base/. Also there is no
  gstoraster and gstopxl CUPS filter in the package any more and no
  "install-cups" make target any more.
* debian/control, debian/rules, debian/ghostscript-cups.install,
  debian/ghostscript-cups.ppd-updater: Removed the ghostscript-cups binary
  package. The files are now provided by cups-filters.
* debian/symbols.common: Updated for new upstream source. Applied patch
  which dpkg-gensymbols generated for debian/libgs9.symbols to this file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2001-2012 Artifex Software, Inc.
 
2
   All Rights Reserved.
 
3
 
 
4
   This software is provided AS-IS with no warranty, either express or
 
5
   implied.
 
6
 
 
7
   This software is distributed under license and may not be copied,
 
8
   modified or distributed except as expressly authorized under the terms
 
9
   of the license contained in the file LICENSE in this distribution.
 
10
 
 
11
   Refer to licensing information at http://www.artifex.com or contact
 
12
   Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134, San Rafael,
 
13
   CA  94903, U.S.A., +1(415)492-9861, for further information.
 
14
*/
 
15
 
 
16
/* Ricoh 4081 laser printer driver */
 
17
#include "gdevprn.h"
 
18
 
 
19
#define X_DPI 300                       /* pixels per inch */
 
20
#define Y_DPI 300                       /* pixels per inch */
 
21
 
 
22
/* The device descriptor */
 
23
static dev_proc_print_page(r4081_print_page);
 
24
const gx_device_printer far_data gs_r4081_device =
 
25
  prn_device(prn_bg_procs, "r4081",     /* The print_page proc is compatible with allowing bg printing */
 
26
        85,                             /* width_10ths, 8.5" */
 
27
        110,                            /* height_10ths, 11" */
 
28
        X_DPI, Y_DPI,
 
29
        0.25, 0.16, 0.25, 0.16,         /* margins */
 
30
        1, r4081_print_page);
 
31
 
 
32
/* ------ Internal routines ------ */
 
33
 
 
34
/* Send the page to the printer. */
 
35
static int
 
36
r4081_print_page(gx_device_printer *pdev, FILE *prn_stream)
 
37
{
 
38
        int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
 
39
        int out_size = ((pdev->width + 7) & -8) ;
 
40
        byte *out = (byte *)gs_malloc(pdev->memory, out_size, 1, "r4081_print_page(out)");
 
41
        int lnum = 0;
 
42
        int last = pdev->height;
 
43
 
 
44
        /* Check allocations */
 
45
        if ( out == 0 )
 
46
        {       if ( out )
 
47
                        gs_free(pdev->memory, (char *)out, out_size, 1,
 
48
                                "r4081_print_page(out)");
 
49
                return -1;
 
50
        }
 
51
 
 
52
        /* find the first line which has something to print */
 
53
        while ( lnum < last )
 
54
        {
 
55
                gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
 
56
                if ( out[0] != 0 ||
 
57
                     memcmp((char *)out, (char *)out+1, line_size-1)
 
58
                   )
 
59
                        break;
 
60
                lnum ++;
 
61
        }
 
62
 
 
63
        /* find the last line which has something to print */
 
64
        while (last > lnum) {
 
65
                gdev_prn_copy_scan_lines(pdev, last-1, (byte *)out, line_size);
 
66
                if ( out[0] != 0 ||
 
67
                     memcmp((char *)out, (char *)out+1, line_size-1)
 
68
                   )
 
69
                        break;
 
70
                last --;
 
71
        }
 
72
 
 
73
        /* Initialize the printer and set the starting position. */
 
74
        fprintf(prn_stream,"\033\rP\033\022YB2 \033\022G3,%d,%d,1,1,1,%d@",
 
75
                        out_size, last-lnum, (lnum+1)*720/Y_DPI);
 
76
 
 
77
        /* Print lines of graphics */
 
78
        while ( lnum < last )
 
79
           {
 
80
                gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
 
81
                fwrite(out, sizeof(char), line_size, prn_stream);
 
82
                lnum ++;
 
83
           }
 
84
 
 
85
        /* Eject the page and reinitialize the printer */
 
86
        fputs("\f\033\rP", prn_stream);
 
87
 
 
88
        gs_free(pdev->memory, (char *)out, out_size, 1, "r4081_print_page(out)");
 
89
        return 0;
 
90
}