~ubuntu-branches/ubuntu/jaunty/ghostscript/jaunty-updates

« back to all changes in this revision

Viewing changes to src/gxfdrop.h

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2009-01-20 16:40:45 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: james.westby@ubuntu.com-20090120164045-lnfhi0n30o5lwhwa
Tags: 8.64.dfsg.1~svn9377-0ubuntu1
* New upstream release (SVN rev 9377)
   o Fixes many bugs concerning PDF rendering, to make the PDF printing
     workflow correctly working.
   o Fixes long-standing bugs in many drivers, like input paper tray and
     duplex options not working for the built-in PCL 4, 5, 5c, 5e, and
     6/XL drivers, PDF input not working for bjc600, bjc800, and cups
     output devices, several options not working and uninitialized
     memory with cups output device.
   o Merged nearly all patches of the Ubuntu and Debian packages upstream.
   o Fixes LP: #317810, LP: #314439, LP: #314018.
* debian/patches/03_libpaper_support.dpatch,
  debian/patches/11_gs-cjk_font_glyph_handling_fix.dpatch,
  debian/patches/12_gs-cjk_vertical_writing_metrics_fix.dpatch,
  debian/patches/13_gs-cjk_cjkps_examples.dpatch,
  debian/patches/20_bbox_segv_fix.dpatch,
  debian/patches/21_brother_7x0_gdi_fix.dpatch,
  debian/patches/22_epsn_margin_workaround.dpatch,
  debian/patches/24_gs_man_fix.dpatch,
  debian/patches/25_toolbin_insecure_tmp_usage_fix.dpatch,
  debian/patches/26_assorted_script_fixes.dpatch,
  debian/patches/29_gs_css_fix.dpatch,
  debian/patches/30_ps2pdf_man_improvement.dpatch,
  debian/patches/31_fix-gc-sigbus.dpatch,
  debian/patches/34_ftbfs-on-hurd-fix.dpatch,
  debian/patches/35_disable_libcairo.dpatch,
  debian/patches/38_pxl-duplex.dpatch,
  debian/patches/39_pxl-resolution.dpatch,
  debian/patches/42_gs-init-ps-delaybind-fix.dpatch,
  debian/patches/45_bjc600-bjc800-pdf-input.dpatch,
  debian/patches/48_cups-output-device-pdf-duplex-uninitialized-memory-fix.dpatch,
  debian/patches/50_lips4-floating-point-exception.dpatch,
  debian/patches/52_cups-device-logging.dpatch,
  debian/patches/55_pcl-input-slot-fix.dpatch,
  debian/patches/57_pxl-input-slot-fix.dpatch,
  debian/patches/60_pxl-cups-driver-pdf.dpatch,
  debian/patches/62_onebitcmyk-pdf.dpatch,
  debian/patches/65_too-big-temp-files-1.dpatch,
  debian/patches/67_too-big-temp-files-2.dpatch,
  debian/patches/70_take-into-account-data-in-stream-buffer-before-refill.dpatch:
  Removed, applied upstream.
* debian/patches/01_docdir_fix_for_debian.dpatch,
  debian/patches/02_gs_man_fix_debian.dpatch,
  debian/patches/01_docdir-fix-for-debian.dpatch,
  debian/patches/02_docdir-fix-for-debian.dpatch: Renamed patches to
  make merging with Debian easier.
* debian/patches/32_improve-handling-of-media-size-changes-from-gv.dpatch, 
  debian/patches/33_bad-params-to-xinitimage-on-large-bitmaps.dpatch:
  regenerated for new source directory structure.
* debian/rules: Corrected paths to remove cidfmap (it is in Resource/Init/
  in GS 8.64) and to install headers (source paths are psi/ and base/ now).
* debian/rules: Remove all fontmaps, as DeFoMa replaces them.
* debian/local/pdftoraster/pdftoraster.c,
  debian/local/pdftoraster/pdftoraster.convs, debian/rules: Removed
  added pdftoraster filter and use the one which comes with Ghostscript.
* debian/ghostscript.links: s/8.63/8.64/

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2001-2006 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, modified
8
 
   or distributed except as expressly authorized under the terms of that
9
 
   license.  Refer to licensing information at http://www.artifex.com/
10
 
   or contact Artifex Software, Inc.,  7 Mt. Lassen Drive - Suite A-134,
11
 
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
 
*/
13
 
 
14
 
/* $Id: gxfdrop.h 8022 2007-06-05 22:23:38Z giles $ */
15
 
/* Dropout prevention for a character rasterization. */
16
 
 
17
 
#ifndef gxfdrop_INCLUDED
18
 
#  define gxfdrop_INCLUDED
19
 
 
20
 
 
21
 
/*  The structure margin_set and related structures and functions are used for 
22
 
    preventing dropouts rasterizing a character with zero fill adjustment. The purpose
23
 
    is to paint something along thin quazi-horizontal stems,
24
 
    which are composed of multiple small segments (such as a result of flattenpath).
25
 
    We call it "pseudo-rasterization".
26
 
    When fill adjustment takes place, this stuff is not required and is being skipped.
27
 
 
28
 
    To prevent dropouts in thin quazi-horizontal stems we look at raster
29
 
    through 1xN pixels window, where N is the width of the path bounding box.
30
 
    This window moves from bottom to top synchronousely with the motion of
31
 
    the filling loop, but its Y coordinate is always an integer plus one half
32
 
    (actually it moves convulsively).
33
 
    Through this window we can see an upper half of a pixel row,
34
 
    and lower half of the next pixel row. Painted spots are visible through
35
 
    this window as a set of "margins". To handle them we maintain
36
 
    a list of margin_s structures (each of which describes an interval
37
 
    to be painted), and array of "sections" (i-th section corresponds to
38
 
    half-integer X-coordinate Xi = bbox_left + i + 0.5, and stores fraction
39
 
    part of y-coordinate of intersection of the line x == Xi with margin
40
 
    boudaries, being visible through window (only extremal coordinates are stored 
41
 
    into a section)).
42
 
 
43
 
    The structure margin_set snaps what has been painted inside window.
44
 
    We handle 2 instances of margin_set : margin_set0 is being prepared and margin_set1 is
45
 
    being refinished. When the filling loop steps down over a pixel center,
46
 
    the refinished window is closed and released, the prapared window becomes
47
 
    the refinished one, and a new one starts to prepare.
48
 
 
49
 
    fixme:
50
 
    The current implementation is not optimised for very bold characters.
51
 
    We could encrease performance for them with maintaining
52
 
    a separate list of "exclusive" margins, which correspond
53
 
    to intervals painted with regular trapezoids and made with
54
 
    complete_margin. Using them we could skip access to 'sect' array elements
55
 
    inside "exclusive" margins, so that the number of small steps
56
 
    sensibly decreeses.
57
 
 
58
 
    fixme:
59
 
    Another optimization could be applied to the regular(old) trapezoid algorithm.
60
 
    Currently it breaks stems at any step of the Y cycle,
61
 
    generating big number of trapezoids.
62
 
    Perhaps we could store trapezoid vertices to active_line,
63
 
    and delay rendering a trapezoid until stem changes boundary segments.
64
 
    This also would make calls to the margin staff less frequent.
65
 
 
66
 
*/
67
 
 
68
 
/*
69
 
 * Configuration flags for the dropout prevention code.
70
 
 */
71
 
#define ADJUST_SERIF 1 /* See comments near occurances. */
72
 
#define CHECK_SPOT_CONTIGUITY 1 /* See comments near occurances. */
73
 
 
74
 
#ifndef active_line_DEFINED
75
 
#  define active_line_DEFINED
76
 
typedef struct active_line_s active_line;
77
 
#endif
78
 
 
79
 
#ifndef line_list_DEFINED
80
 
#  define line_list_DEFINED
81
 
typedef struct line_list_s line_list;
82
 
#endif
83
 
 
84
 
typedef struct margin_s
85
 
{   int ibeg, iend; /* Pixel indices of an interval to paint. */
86
 
    struct margin_s *prev, *next;
87
 
} margin;
88
 
 
89
 
typedef struct section_s
90
 
{   short y0, y1; /* Fraction part of y coordinates of intersections of the margin with line x==i + bbox_left */
91
 
#if ADJUST_SERIF && CHECK_SPOT_CONTIGUITY
92
 
    short x0, x1; /* Pixel coverage by X for checking the contiguity. */
93
 
#endif
94
 
} section;
95
 
 
96
 
typedef struct margin_set_s
97
 
{   fixed y; 
98
 
    margin *margin_list, *margin_touched;
99
 
    section *sect;
100
 
} margin_set;
101
 
 
102
 
extern_st(st_section);
103
 
 
104
 
/* vd_trace helpers. */
105
 
#define VD_SCALE 0.03
106
 
#define VD_RECT(x, y, w, h, c) vd_rect(int2fixed(x), int2fixed(y), int2fixed(x + w), int2fixed(y + h), 1, c)
107
 
#define VD_TRAP_COLOR RGB(0, 255, 255)
108
 
#define VD_MARG_COLOR RGB(255, 0, 0)
109
 
 
110
 
void init_section(section *sect, int i0, int i1);
111
 
void free_all_margins(line_list * ll);
112
 
int close_margins(gx_device * dev, line_list * ll, margin_set *ms);
113
 
int process_h_lists(line_list * ll, active_line * plp, active_line * flp, active_line * alp, fixed y0, fixed y1);
114
 
int margin_interior(line_list * ll, active_line * flp, active_line * alp, fixed y0, fixed y1);
115
 
int start_margin_set(gx_device * dev, line_list * ll, fixed y0);
116
 
int continue_margin_common(line_list * ll, margin_set * set, active_line * flp, active_line * alp, fixed y0, fixed y1);
117
 
 
118
 
#endif /* gxfdrop_INCLUDED */