~ubuntu-branches/ubuntu/oneiric/ghostscript/oneiric

« back to all changes in this revision

Viewing changes to base/gdevmiff.c

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2011-07-15 16:49:55 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20110715164955-uga6qibao6kez05c
Tags: 9.04~dfsg~20110715-0ubuntu1
* New upstream release
   - GIT snapshot from Jult, 12 2011.
* debian/patches/020110406~a54df2d.patch,
  debian/patches/020110408~0791cc8.patch,
  debian/patches/020110408~507cbee.patch,
  debian/patches/020110411~4509a49.patch,
  debian/patches/020110412~78bb9a6.patch,
  debian/patches/020110418~a05ab8a.patch,
  debian/patches/020110420~20b6c78.patch,
  debian/patches/020110420~4ddefa2.patch: Removed upstream patches.
* debian/rules: Generate ABI version number (variable "abi") correctly,
  cutting off repackaging and pre-release parts.
* debian/rules: Added ./lcms2/ directory to DEB_UPSTREAM_REPACKAGE_EXCLUDES.
* debian/copyright: Added lcms2/* to the list of excluded files.
* 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
1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
2
2
   All Rights Reserved.
3
 
  
 
3
 
4
4
   This software is provided AS-IS with no warranty, either express or
5
5
   implied.
6
6
 
10
10
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
 
/* $Id: gdevmiff.c 8250 2007-09-25 13:31:24Z giles $ */
 
13
/* $Id$ */
14
14
/* MIFF file format driver */
15
15
#include "gdevprn.h"
16
16
 
26
26
 
27
27
static const gx_device_procs miff24_procs =
28
28
prn_color_procs(gdev_prn_open, gdev_prn_output_page, gdev_prn_close,
29
 
                gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
 
29
                gx_default_rgb_map_rgb_color, gx_default_rgb_map_color_rgb);
30
30
const gx_device_printer gs_miff24_device =
31
31
prn_device(miff24_procs, "miff24",
32
 
           DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
33
 
           X_DPI, Y_DPI,
34
 
           0, 0, 0, 0,          /* margins */
35
 
           24, miff24_print_page);
 
32
           DEFAULT_WIDTH_10THS, DEFAULT_HEIGHT_10THS,
 
33
           X_DPI, Y_DPI,
 
34
           0, 0, 0, 0,          /* margins */
 
35
           24, miff24_print_page);
36
36
 
37
37
/* Print one page in 24-bit RLE direct color format. */
38
38
static int
44
44
    int code = 0;               /* return code */
45
45
 
46
46
    if (line == 0)              /* can't allocate line buffer */
47
 
        return_error(gs_error_VMerror);
 
47
        return_error(gs_error_VMerror);
48
48
    fputs("id=ImageMagick\n", file);
49
49
    fputs("class=DirectClass\n", file);
50
50
    fprintf(file, "columns=%d\n", pdev->width);
52
52
    fprintf(file, "rows=%d\n", pdev->height);
53
53
    fputs(":\n", file);
54
54
    for (y = 0; y < pdev->height; ++y) {
55
 
        byte *row;
56
 
        byte *end;
57
 
 
58
 
        code = gdev_prn_get_bits(pdev, y, line, &row);
59
 
        if (code < 0)
60
 
            break;
61
 
        end = row + pdev->width * 3;
62
 
        while (row < end) {
63
 
            int count = 0;
64
 
 
65
 
            while (count < 255 && row < end - 3 &&
66
 
                   row[0] == row[3] && row[1] == row[4] &&
67
 
                   row[2] == row[5]
68
 
                )
69
 
                ++count, row += 3;
70
 
            putc(row[0], file);
71
 
            putc(row[1], file);
72
 
            putc(row[2], file);
73
 
            putc(count, file);
74
 
            row += 3;
75
 
        }
 
55
        byte *row;
 
56
        byte *end;
 
57
 
 
58
        code = gdev_prn_get_bits(pdev, y, line, &row);
 
59
        if (code < 0)
 
60
            break;
 
61
        end = row + pdev->width * 3;
 
62
        while (row < end) {
 
63
            int count = 0;
 
64
 
 
65
            while (count < 255 && row < end - 3 &&
 
66
                   row[0] == row[3] && row[1] == row[4] &&
 
67
                   row[2] == row[5]
 
68
                )
 
69
                ++count, row += 3;
 
70
            putc(row[0], file);
 
71
            putc(row[1], file);
 
72
            putc(row[2], file);
 
73
            putc(count, file);
 
74
            row += 3;
 
75
        }
76
76
    }
77
77
    gs_free_object(pdev->memory, line, "miff line buffer");
78
78