~ubuntu-branches/ubuntu/intrepid/xserver-xgl/intrepid

« back to all changes in this revision

Viewing changes to Xprint/ps/PsSpans.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthew Garrett
  • Date: 2006-02-13 14:21:43 UTC
  • Revision ID: james.westby@ubuntu.com-20060213142143-mad6z9xzem7hzxz9
Tags: upstream-7.0.0
ImportĀ upstreamĀ versionĀ 7.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* $Xorg: PsSpans.c,v 1.4 2001/02/09 02:04:36 xorgcvs Exp $ */
 
2
/*
 
3
 
 
4
Copyright 1996, 1998  The Open Group
 
5
 
 
6
Permission to use, copy, modify, distribute, and sell this software and its
 
7
documentation for any purpose is hereby granted without fee, provided that
 
8
the above copyright notice appear in all copies and that both that
 
9
copyright notice and this permission notice appear in supporting
 
10
documentation.
 
11
 
 
12
The above copyright notice and this permission notice shall be included in
 
13
all copies or substantial portions of the Software.
 
14
 
 
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
21
 
 
22
Except as contained in this notice, the name of The Open Group shall not be
 
23
used in advertising or otherwise to promote the sale, use or other dealings
 
24
in this Software without prior written authorization from The Open Group.
 
25
 
 
26
*/
 
27
/*
 
28
 * (c) Copyright 1996 Hewlett-Packard Company
 
29
 * (c) Copyright 1996 International Business Machines Corp.
 
30
 * (c) Copyright 1996 Sun Microsystems, Inc.
 
31
 * (c) Copyright 1996 Novell, Inc.
 
32
 * (c) Copyright 1996 Digital Equipment Corp.
 
33
 * (c) Copyright 1996 Fujitsu Limited
 
34
 * (c) Copyright 1996 Hitachi, Ltd.
 
35
 *
 
36
 * Permission is hereby granted, free of charge, to any person obtaining
 
37
 * a copy of this software and associated documentation files (the
 
38
 * "Software"), to deal in the Software without restriction, including
 
39
 * without limitation the rights to use, copy, modify, merge, publish,
 
40
 * distribute, sublicense, and/or sell copies of the Software, and to
 
41
 * permit persons to whom the Software is furnished to do so, subject
 
42
 * to the following conditions:
 
43
 *
 
44
 * The above copyright notice and this permission notice shall be included
 
45
 * in all copies or substantial portions of the Software.
 
46
 *
 
47
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
48
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
49
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
50
 * THE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 
51
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
 
52
 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 
53
 * SOFTWARE.
 
54
 *
 
55
 * Except as contained in this notice, the names of the copyright holders
 
56
 * shall not be used in advertising or otherwise to promote the sale, use
 
57
 * or other dealings in this Software without prior written authorization
 
58
 * from said copyright holders.
 
59
 */
 
60
 
 
61
/*******************************************************************
 
62
**
 
63
**    *********************************************************
 
64
**    *
 
65
**    *  File:          PsSpans.c
 
66
**    *
 
67
**    *  Contents:      Code to set and fill spans in the PS DDX
 
68
**    *
 
69
**    *  Created By:    Roger Helmendach (Liberty Systems)
 
70
**    *
 
71
**    *  Copyright:     Copyright 1996 The Open Group, Inc.
 
72
**    *
 
73
**    *********************************************************
 
74
** 
 
75
********************************************************************/
 
76
/* $XFree86: xc/programs/Xserver/Xprint/ps/PsSpans.c,v 1.8 2001/10/28 03:32:56 tsi Exp $ */
 
77
 
 
78
#ifdef HAVE_DIX_CONFIG_H
 
79
#include <dix-config.h>
 
80
#endif
 
81
 
 
82
#include "Ps.h"
 
83
#include "gcstruct.h"
 
84
#include "windowstr.h"
 
85
 
 
86
void
 
87
PsFillSpans(
 
88
  DrawablePtr  pDrawable,
 
89
  GCPtr        pGC,
 
90
  int          nSpans,
 
91
  DDXPointPtr  pPoints,
 
92
  int         *pWidths,
 
93
  int          fSorted)
 
94
{
 
95
  PsOutPtr    psOut;
 
96
  int         xoffset, yoffset;
 
97
  xRectangle *rects, *r;
 
98
  RegionPtr   fillRegion, region = 0;
 
99
  int         i;
 
100
  int         nbox;
 
101
  BoxPtr      pbox;
 
102
  ColormapPtr cMap;
 
103
 
 
104
  if( PsUpdateDrawableGC(pGC, pDrawable, &psOut, &cMap)==FALSE ) return;
 
105
 
 
106
  /*
 
107
   * Build a region out of the spans
 
108
   */
 
109
  rects   = (xRectangle *)xalloc(nSpans*sizeof(xRectangle));
 
110
  xoffset = pDrawable->x;
 
111
  yoffset = pDrawable->y;
 
112
 
 
113
  for( i = 0, r = rects; i < nSpans; i++, r++ )
 
114
  {
 
115
    r->x = pPoints[i].x + xoffset;
 
116
    r->y = pPoints[i].y + yoffset;
 
117
    r->width = pWidths[i];
 
118
    r->height = 1;
 
119
  }
 
120
  fillRegion = RECTS_TO_REGION(pGC->pScreen, nSpans, rects,
 
121
                               (fSorted)?CT_YSORTED:CT_UNSORTED);
 
122
 
 
123
  /*
 
124
   * Intersect this region with the clip region.  Whatever's left,
 
125
   * should be filled.
 
126
   */
 
127
/*REGION_INTERSECT(pGC->pScreen, region, fillRegion, pGC->clientClip);*/
 
128
 
 
129
  pbox = REGION_RECTS(region);
 
130
  nbox = REGION_NUM_RECTS(region);
 
131
 
 
132
  /* Enter HP-GL/2 */
 
133
  /*###SEND_PCL( outFile, "\27%0B" );*/
 
134
 
 
135
  while( nbox )
 
136
  {
 
137
/*###
 
138
    sprintf( t, "PU%d,%d;RR%d,%d;", pbox->x1, pbox->y1, pbox->x2, pbox->y2);
 
139
    SEND_PCL( outFile, t );
 
140
*/
 
141
    nbox--;
 
142
    pbox++;
 
143
  }
 
144
 
 
145
  /* Go back to PCL */
 
146
  /*###SEND_PCL( outFile, "\27%0A" );*/
 
147
 
 
148
  /*
 
149
   * Clean up the temporary regions
 
150
   */
 
151
  REGION_DESTROY(pGC->pScreen, fillRegion);
 
152
  REGION_DESTROY(pGC->pScreen, region);
 
153
  xfree(rects);
 
154
}
 
155
 
 
156
void
 
157
PsSetSpans(
 
158
  DrawablePtr  pDrawable,
 
159
  GCPtr        pGC,
 
160
  char        *pSrc,
 
161
  DDXPointPtr  pPoints,
 
162
  int         *pWidths,
 
163
  int          nSpans,
 
164
  int          fSorted)
 
165
{
 
166
}