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

« back to all changes in this revision

Viewing changes to devices/gdevsnfb.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
 
 
17
/* Sony News frame buffer driver for GhostScript */
 
18
#include "gdevprn.h"
 
19
#define prn_dev ((gx_device_printer *)dev) /* needed in 5.31 et seq */
 
20
/*#include <sys/types.h> problems with ushort! */
 
21
typedef char *  caddr_t;
 
22
typedef long    off_t;
 
23
#include <sys/uio.h>
 
24
#include <newsiop/framebuf.h>
 
25
 
 
26
/* The device descriptor */
 
27
static dev_proc_open_device(sonyfb_open);
 
28
static dev_proc_output_page(sonyfb_output_page);
 
29
static dev_proc_close_device(sonyfb_close);
 
30
static gx_device_procs sonyfb_procs =
 
31
  prn_procs(sonyfb_open, sonyfb_output_page, sonyfb_close);
 
32
const gx_device_printer far_data gs_sonyfb_device =
 
33
  prn_device(sonyfb_procs, "sonyfb",
 
34
        102.4,                          /* width_10ths */
 
35
        103.2,                          /* height_10ths */
 
36
        100,                            /* x_dpi */
 
37
        100,                            /* y_dpi */
 
38
        0,0,0,0,                        /* margins */
 
39
        1, 0);
 
40
 
 
41
static int fb_file = -1;
 
42
sPrimRect prect;
 
43
 
 
44
static int
 
45
sonyfb_open(gx_device *dev)
 
46
{
 
47
  sScrType stype;
 
48
 
 
49
  if(fb_file < 0)
 
50
    if((fb_file = open("/dev/fb", 2)) < 0)
 
51
      perror("open failed");
 
52
    else
 
53
      if(ioctl(fb_file, FBIOCGETSCRTYPE, &stype) < 0)
 
54
        perror("ioctl failed");
 
55
      else
 
56
        prect.rect = stype.visiblerect;
 
57
 
 
58
  return gdev_prn_open(dev);
 
59
}
 
60
 
 
61
static int
 
62
sonyfb_close(gx_device *dev)
 
63
{
 
64
  if(fb_file >= 0)
 
65
    {
 
66
      close(fb_file);
 
67
      fb_file = -1;
 
68
    }
 
69
  return gdev_prn_close(dev);
 
70
}
 
71
 
 
72
#define FRAME_WIDTH     1024
 
73
 
 
74
/* Send the page to the printer. */
 
75
static int
 
76
sonyfb_output_page(gx_device *dev, int num_copies, int flush)
 
77
{
 
78
  int l, i, byte_width, height;
 
79
  unsigned char *bm, *fbs, *fb;
 
80
 
 
81
  byte_width = (dev->width + 7) / 8;
 
82
  height = dev->height;
 
83
  bm     = (typeof(bm))prn_dev->mem.base;
 
84
 
 
85
  prect.refPoint.x = 0;
 
86
  prect.refPoint.y = 0;
 
87
  prect.ptnRect = prect.rect;
 
88
 
 
89
  prect.ptnBM.type  = BM_MEM;
 
90
  prect.ptnBM.depth = 1;
 
91
  prect.ptnBM.width = (byte_width + 1) / 2;
 
92
  prect.ptnBM.rect.origin.x = 0;
 
93
  prect.ptnBM.rect.origin.y = 0;
 
94
  prect.ptnBM.rect.extent.x = byte_width * 8; /* width in 16bit words */
 
95
  prect.ptnBM.rect.extent.y = height;
 
96
  prect.ptnBM.base = (typeof(prect.ptnBM.base))bm;
 
97
 
 
98
  prect.fore_color = 1;
 
99
  prect.aux_color = 0;
 
100
  prect.planemask = FB_PLANEALL;
 
101
  prect.transp = 0;
 
102
  prect.func = BF_S;
 
103
  prect.clip = prect.rect;
 
104
  prect.drawBM.type  = BM_FB;
 
105
  prect.drawBM.depth = 1;
 
106
  prect.drawBM.width = (prect.rect.extent.x + 15) / 16;
 
107
  prect.drawBM.rect = prect.rect;
 
108
  prect.drawBM.base = 0;
 
109
 
 
110
  if(ioctl(fb_file, FBIOCRECTANGLE, &prect) < 0)
 
111
    perror("rect ioctl failed");
 
112
 
 
113
  return gx_finish_output_page(dev, num_copies, flush);
 
114
}