~ubuntu-branches/ubuntu/edgy/xorg-server/edgy-updates

« back to all changes in this revision

Viewing changes to iplan2p4/iplbresd.c

  • Committer: Bazaar Package Importer
  • Author(s): Rodrigo Parra Novo
  • Date: 2006-07-25 20:06:28 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20060725200628-gjmmd9gxfxdc4ejs
Tags: 1:1.1.1-0ubuntu1
* New Upstream version
* Changed Build-Depends from mesa-swrast-source to mesa-swx11-source,
  following Debian package nomenclature
* Re-did 12_security_policy_in_etc.diff for 1.1.1
* Dropped 15_security_allocate_local.diff (applied upstream)
* Dropped 16_SECURITY_setuid.diff (applied upstream)
* Dropped 000_ubuntu_fix_read_kernel_mapping.patch (applied upstream)
* Dropped 002_ubuntu_fix_for_certain_intel_chipsets.patch (applied upstream)
* Updated versioned Build-Depends on mesa-swx11-source to version
  6.5.0.cvs.20060725-0ubuntu1
* Added arrayobj.c, arrayobj.h, bitset.h & rbadaptors.h to
  GL/symlink-mesa.sh (linked from mesa-swx11-source)
* Added arrayobj.c to default build target on GL/mesa/main

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $XFree86$ */
2
 
/***********************************************************
3
 
 
4
 
Copyright (c) 1987  X Consortium
5
 
 
6
 
Permission is hereby granted, free of charge, to any person obtaining a copy
7
 
of this software and associated documentation files (the "Software"), to deal
8
 
in the Software without restriction, including without limitation the rights
9
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
 
copies of the Software, and to permit persons to whom the Software is
11
 
furnished to do so, subject to the following conditions:
12
 
 
13
 
The above copyright notice and this permission notice shall be included in
14
 
all copies or substantial portions of the Software.
15
 
 
16
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
19
 
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
20
 
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
21
 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
 
 
23
 
Except as contained in this notice, the name of the X Consortium shall not be
24
 
used in advertising or otherwise to promote the sale, use or other dealings
25
 
in this Software without prior written authorization from the X Consortium.
26
 
 
27
 
 
28
 
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
29
 
 
30
 
                        All Rights Reserved
31
 
 
32
 
Permission to use, copy, modify, and distribute this software and its 
33
 
documentation for any purpose and without fee is hereby granted, 
34
 
provided that the above copyright notice appear in all copies and that
35
 
both that copyright notice and this permission notice appear in 
36
 
supporting documentation, and that the name of Digital not be
37
 
used in advertising or publicity pertaining to distribution of the
38
 
software without specific, written prior permission.  
39
 
 
40
 
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
41
 
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
42
 
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
43
 
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
44
 
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
45
 
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
46
 
SOFTWARE.
47
 
 
48
 
******************************************************************/
49
 
/* $XConsortium: iplbresd.c,v 1.16 94/04/17 20:28:45 dpw Exp $ */
50
 
 
51
 
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
52
 
interleaved planes */
53
 
 
54
 
#ifdef HAVE_DIX_CONFIG_H
55
 
#include <dix-config.h>
56
 
#endif
57
 
 
58
 
#include <X11/X.h>
59
 
#include "misc.h"
60
 
#include "ipl.h"
61
 
#include "miline.h"
62
 
#include "iplmskbits.h"
63
 
 
64
 
/* Dashed bresenham line */
65
 
 
66
 
void
67
 
iplBresD(rrops,
68
 
         pdashIndex, pDash, numInDashList, pdashOffset, isDoubleDash,
69
 
         addrg, ngwidth,
70
 
         signdx, signdy, axis, x1, y1, e, e1, e2, len)
71
 
    iplRRopPtr      rrops;
72
 
    int             *pdashIndex;        /* current dash */
73
 
    unsigned char   *pDash;             /* dash list */
74
 
    int             numInDashList;      /* total length of dash list */
75
 
    int             *pdashOffset;       /* offset into current dash */
76
 
    int             isDoubleDash;
77
 
    INTER_DECLAREG(*addrg);             /* pointer to base of bitmap */
78
 
    int             ngwidth;            /* width in groups of bitmap */
79
 
    int             signdx, signdy;     /* signs of directions */
80
 
    int             axis;               /* major axis (Y_AXIS or X_AXIS) */
81
 
    int             x1, y1;             /* initial point */
82
 
    register int    e;                  /* error accumulator */
83
 
    register int    e1;                 /* bresenham increments */
84
 
    int             e2;
85
 
    int             len;                /* length of line */
86
 
{
87
 
    register            int e3 = e2-e1;
88
 
    int                 dashIndex;
89
 
    int                 dashOffset;
90
 
    int                 dashRemaining;
91
 
    INTER_DECLARERRAX(xorFg);
92
 
    INTER_DECLARERRAX(andFg);
93
 
    INTER_DECLARERRAX(xorBg);
94
 
    INTER_DECLARERRAX(andBg);
95
 
    int                 thisDash;
96
 
 
97
 
    dashOffset = *pdashOffset;
98
 
    dashIndex = *pdashIndex;
99
 
    xorFg = rrops[0].xorg;
100
 
    andFg = rrops[0].andg;
101
 
    xorBg = rrops[1].xorg;
102
 
    andBg = rrops[1].andg;
103
 
    dashRemaining = pDash[dashIndex] - dashOffset;
104
 
    if ((thisDash = dashRemaining) >= len)
105
 
    {
106
 
        thisDash = len;
107
 
        dashRemaining -= len;
108
 
    }
109
 
    e = e-e1;                   /* to make looping easier */
110
 
 
111
 
#define BresStep(minor,major) {if ((e += e1) >= 0) { e += e3; minor; } major;}
112
 
 
113
 
#define NextDash {\
114
 
    dashIndex++; \
115
 
    if (dashIndex == numInDashList) \
116
 
        dashIndex = 0; \
117
 
    dashRemaining = pDash[dashIndex]; \
118
 
    if ((thisDash = dashRemaining) >= len) \
119
 
    { \
120
 
        dashRemaining -= len; \
121
 
        thisDash = len; \
122
 
    } \
123
 
}
124
 
 
125
 
    {
126
 
        INTER_DECLAREG(startbit);
127
 
        INTER_DECLAREG(bit);
128
 
 
129
 
        /* point to longword containing first point */
130
 
        addrg = addrg + (y1 * ngwidth) + (x1 >> INTER_PGSH) * INTER_PLANES;
131
 
        signdy = signdy * ngwidth;
132
 
        signdx = signdx * INTER_PLANES;
133
 
 
134
 
        if (signdx > 0)
135
 
            startbit = iplmask[0];
136
 
        else
137
 
            startbit = iplmask[INTER_PPG-1];
138
 
        bit = iplmask[x1 & INTER_PIM];
139
 
 
140
 
#define X_Loop(store)   while(thisDash--) {\
141
 
                            store; \
142
 
                            BresStep(addrg += signdy, \
143
 
                                     if (signdx > 0) \
144
 
                                         bit >>= 1; \
145
 
                                     else \
146
 
                                         bit <<= 1; \
147
 
                                     if (!bit) \
148
 
                                     { \
149
 
                                         bit = startbit; \
150
 
                                         addrg += signdx; \
151
 
                                     }) \
152
 
                        }
153
 
#define Y_Loop(store)   while(thisDash--) {\
154
 
                            store; \
155
 
                            BresStep(if (signdx > 0) \
156
 
                                         bit >>= 1; \
157
 
                                     else \
158
 
                                         bit <<= 1; \
159
 
                                     if (!bit) \
160
 
                                     { \
161
 
                                         bit = startbit; \
162
 
                                         addrg += signdx; \
163
 
                                     }, \
164
 
                                     addrg += signdy) \
165
 
                        }
166
 
 
167
 
        if (axis == X_AXIS)
168
 
        {
169
 
            for (;;)
170
 
            {
171
 
                len -= thisDash;
172
 
                if (dashIndex & 1) {
173
 
                    if (isDoubleDash) {
174
 
                        X_Loop(
175
 
                        INTER_DoMaskRRop(addrg, andBg, xorBg, bit, addrg);
176
 
                        )
177
 
                    } else {
178
 
                        X_Loop(;)
179
 
                    }
180
 
                } else {
181
 
                    X_Loop(INTER_DoMaskRRop(addrg, andFg, xorFg, bit, addrg));
182
 
                }
183
 
                if (!len)
184
 
                    break;
185
 
                NextDash
186
 
            }
187
 
        } /* if X_AXIS */
188
 
        else
189
 
        {
190
 
            for (;;)
191
 
            {
192
 
                len -= thisDash;
193
 
                if (dashIndex & 1) {
194
 
                    if (isDoubleDash) {
195
 
                        Y_Loop(
196
 
                        INTER_DoMaskRRop(addrg, andBg, xorBg, bit, addrg);
197
 
                        )
198
 
                    } else {
199
 
                        Y_Loop(;)
200
 
                    }
201
 
                } else {
202
 
                    Y_Loop(INTER_DoMaskRRop(addrg, andFg, xorFg, bit, addrg));
203
 
                }
204
 
                if (!len)
205
 
                    break;
206
 
                NextDash
207
 
            }
208
 
        } /* else Y_AXIS */
209
 
    }
210
 
    *pdashIndex = dashIndex;
211
 
    *pdashOffset = pDash[dashIndex] - dashRemaining;
212
 
}