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

« back to all changes in this revision

Viewing changes to iplan2p4/ipltile32.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: xc/programs/Xserver/iplan2p4/ipltile32.c,v 3.0 1996/08/18 01:55:10 dawes Exp $ */
2
 
/*
3
 
 * Fill 32 bit tiled rectangles.  Used by both PolyFillRect and PaintWindow.
4
 
 * no depth dependencies.
5
 
 */
6
 
 
7
 
/*
8
 
 
9
 
Copyright (c) 1989  X Consortium
10
 
 
11
 
Permission is hereby granted, free of charge, to any person obtaining a copy
12
 
of this software and associated documentation files (the "Software"), to deal
13
 
in the Software without restriction, including without limitation the rights
14
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
 
copies of the Software, and to permit persons to whom the Software is
16
 
furnished to do so, subject to the following conditions:
17
 
 
18
 
The above copyright notice and this permission notice shall be included in
19
 
all copies or substantial portions of the Software.
20
 
 
21
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
24
 
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
25
 
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
26
 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27
 
 
28
 
Except as contained in this notice, the name of the X Consortium shall not be
29
 
used in advertising or otherwise to promote the sale, use or other dealings
30
 
in this Software without prior written authorization from the X Consortium.
31
 
*/
32
 
 
33
 
/* $XConsortium: ipltile32.c,v 1.8 94/04/17 20:29:05 dpw Exp $ */
34
 
 
35
 
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
36
 
interleaved planes */
37
 
 
38
 
#ifdef HAVE_DIX_CONFIG_H
39
 
#include <dix-config.h>
40
 
#endif
41
 
 
42
 
#include <X11/X.h>
43
 
#include <X11/Xmd.h>
44
 
#include "servermd.h"
45
 
#include "gcstruct.h"
46
 
#include "window.h"
47
 
#include "pixmapstr.h"
48
 
#include "scrnintstr.h"
49
 
#include "windowstr.h"
50
 
 
51
 
#include "ipl.h"
52
 
 
53
 
#include "mi.h"
54
 
#include "mispans.h"
55
 
 
56
 
#include "iplmskbits.h"
57
 
#include "iplmergerop.h"
58
 
 
59
 
#define STORE(p)    INTER_MROP_PREBUILT_SOLID(srcpix, p, p)
60
 
 
61
 
#define Expand(left,right) {\
62
 
    while (h--) { \
63
 
        INTER_COPY(psrc+srcy*INTER_PLANES, srcpix); \
64
 
        INTER_MROP_PREBUILD(srcpix); \
65
 
        ++srcy; \
66
 
        if (srcy == tileHeight) \
67
 
            srcy = 0; \
68
 
        left \
69
 
        ngw = ngwMiddle; \
70
 
        while (ngw--) \
71
 
        { \
72
 
            STORE(p); \
73
 
            INTER_NEXT_GROUP(p); \
74
 
        } \
75
 
        right \
76
 
        p += ngwExtra; \
77
 
    } \
78
 
}
79
 
 
80
 
void
81
 
INTER_MROP_NAME(iplFillRectTile32) (pDrawable, pGC, nBox, pBox)
82
 
    DrawablePtr     pDrawable;
83
 
    GCPtr           pGC;
84
 
    int             nBox;       /* number of boxes to fill */
85
 
    BoxPtr          pBox;       /* pointer to list of boxes to fill */
86
 
{
87
 
    INTER_DECLAREGP(srcpix);
88
 
    INTER_DECLAREG(*psrc);      /* pointer to bits in tile, if needed */
89
 
    int tileHeight;     /* height of the tile */
90
 
 
91
 
    int ngwDst;         /* width in longwords of the dest pixmap */
92
 
    int w;              /* width of current box */
93
 
    register int h;     /* height of current box */
94
 
    INTER_DECLAREG(startmask);
95
 
    INTER_DECLAREG(endmask); /* masks for reggedy bits at either end of line */
96
 
    int ngwMiddle;      /* number of longwords between sides of boxes */
97
 
    int ngwExtra;       /* to get from right of box to left of next span */
98
 
    register int ngw;   /* loop version of ngwMiddle */
99
 
    INTER_DECLAREG(*p); /* pointer to bits we're writing */
100
 
    int y;              /* current scan line */
101
 
    int srcy;           /* current tile position */
102
 
 
103
 
    INTER_DECLAREG(*pbits); /* pointer to start of pixmap */
104
 
    PixmapPtr       tile;       /* rotated, expanded tile */
105
 
    INTER_MROP_DECLARE_REG()
106
 
    INTER_MROP_PREBUILT_DECLARE()
107
 
 
108
 
    tile = pGC->pRotatedPixmap;
109
 
    tileHeight = tile->drawable.height;
110
 
    psrc = (unsigned short *)tile->devPrivate.ptr;
111
 
 
112
 
    INTER_MROP_INITIALIZE(pGC->alu, pGC->planemask);
113
 
 
114
 
    iplGetGroupWidthAndPointer (pDrawable, ngwDst, pbits)
115
 
 
116
 
    while (nBox--)
117
 
    {
118
 
        w = pBox->x2 - pBox->x1;
119
 
        h = pBox->y2 - pBox->y1;
120
 
        y = pBox->y1;
121
 
        p = pbits + (y * ngwDst) + (pBox->x1 >> INTER_PGSH) * INTER_PLANES;
122
 
        srcy = y % tileHeight;
123
 
 
124
 
        if ( ((pBox->x1 & INTER_PIM) + w) <= INTER_PPG)
125
 
        {
126
 
            INTER_maskpartialbits(pBox->x1, w, startmask);
127
 
            ngwExtra = ngwDst;
128
 
            while (h--)
129
 
            {
130
 
                INTER_COPY(psrc+srcy*INTER_PLANES, srcpix);
131
 
                INTER_MROP_PREBUILD(srcpix);
132
 
                ++srcy;
133
 
                if (srcy == tileHeight)
134
 
                    srcy = 0;
135
 
                INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
136
 
                p += ngwExtra;
137
 
            }
138
 
        }
139
 
        else
140
 
        {
141
 
            INTER_maskbits(pBox->x1, w, startmask, endmask, ngwMiddle);
142
 
            ngwExtra = ngwDst - ngwMiddle * INTER_PLANES;
143
 
 
144
 
            if (startmask)
145
 
            {
146
 
                ngwExtra -= INTER_PLANES;
147
 
                if (endmask)
148
 
                {
149
 
                    Expand(
150
 
                    INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
151
 
                    INTER_NEXT_GROUP(p);,
152
 
                    INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p));
153
 
                }
154
 
                else
155
 
                {
156
 
                    Expand(
157
 
                    INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
158
 
                    INTER_NEXT_GROUP(p);,
159
 
                           ;)
160
 
                }
161
 
            }
162
 
            else
163
 
            {
164
 
                if (endmask)
165
 
                {
166
 
                    Expand(;,
167
 
                    INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p));
168
 
                }
169
 
                else
170
 
                {
171
 
                    Expand(;,
172
 
                           ;)
173
 
                }
174
 
            }
175
 
        }
176
 
        pBox++;
177
 
    }
178
 
}
179
 
 
180
 
void
181
 
INTER_MROP_NAME(iplTile32FS)(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)
182
 
    DrawablePtr pDrawable;
183
 
    GCPtr       pGC;
184
 
    int         nInit;                  /* number of spans to fill */
185
 
    DDXPointPtr pptInit;                /* pointer to list of start points */
186
 
    int         *pwidthInit;            /* pointer to list of n widths */
187
 
    int         fSorted;
188
 
{
189
 
                                /* next three parameters are post-clip */
190
 
    int                 n;      /* number of spans to fill */
191
 
    DDXPointPtr         ppt;    /* pointer to list of start points */
192
 
    int                 *pwidth;/* pointer to list of n widths */
193
 
    INTER_DECLAREG(*pbits);     /* pointer to start of bitmap */
194
 
    int                 ngwDst; /* width in longwords of bitmap */
195
 
    INTER_DECLAREG(*p);         /* pointer to current longword in bitmap */
196
 
    register int        w;      /* current span width */
197
 
    register int        ngw;
198
 
    register int        x;
199
 
    INTER_DECLAREG(startmask);
200
 
    INTER_DECLAREG(endmask);
201
 
    INTER_DECLAREGP(srcpix);
202
 
    int                 y;
203
 
    int                 *pwidthFree;/* copies of the pointers to free */
204
 
    DDXPointPtr         pptFree;
205
 
    PixmapPtr           tile;
206
 
    INTER_DECLAREG(*psrc);      /* pointer to bits in tile */
207
 
    int                 tileHeight;/* height of the tile */
208
 
    INTER_MROP_DECLARE_REG ()
209
 
    INTER_MROP_PREBUILT_DECLARE()
210
 
 
211
 
    n = nInit * miFindMaxBand( iplGetCompositeClip(pGC) );
212
 
    pwidthFree = (int *)ALLOCATE_LOCAL(n * sizeof(int));
213
 
    pptFree = (DDXPointRec *)ALLOCATE_LOCAL(n * sizeof(DDXPointRec));
214
 
    if(!pptFree || !pwidthFree)
215
 
    {
216
 
        if (pptFree) DEALLOCATE_LOCAL(pptFree);
217
 
        if (pwidthFree) DEALLOCATE_LOCAL(pwidthFree);
218
 
        return;
219
 
    }
220
 
    pwidth = pwidthFree;
221
 
    ppt = pptFree;
222
 
    n = miClipSpans( iplGetCompositeClip(pGC),
223
 
                     pptInit, pwidthInit, nInit,
224
 
                     ppt, pwidth, fSorted);
225
 
 
226
 
    tile = pGC->pRotatedPixmap;
227
 
    tileHeight = tile->drawable.height;
228
 
    psrc = (unsigned short *)tile->devPrivate.ptr;
229
 
 
230
 
    INTER_MROP_INITIALIZE(pGC->alu, pGC->planemask);
231
 
 
232
 
    iplGetGroupWidthAndPointer (pDrawable, ngwDst, pbits)
233
 
 
234
 
    {
235
 
        while (n--)
236
 
        {
237
 
            x = ppt->x;
238
 
            y = ppt->y;
239
 
            ++ppt;
240
 
            w = *pwidth++;
241
 
            p = pbits + (y * ngwDst) + (x >> INTER_PGSH) * INTER_PLANES;
242
 
            INTER_COPY(psrc +(y % tileHeight)*INTER_PLANES,srcpix);
243
 
            INTER_MROP_PREBUILD(srcpix);
244
 
    
245
 
            if ((x & INTER_PIM) + w < INTER_PPG)
246
 
            {
247
 
                INTER_maskpartialbits(x, w, startmask);
248
 
                INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
249
 
            }
250
 
            else
251
 
            {
252
 
                INTER_maskbits(x, w, startmask, endmask, ngw);
253
 
                if (startmask)
254
 
                {
255
 
                    INTER_MROP_PREBUILT_MASK(srcpix, p, startmask, p);
256
 
                    INTER_NEXT_GROUP(p);
257
 
                }
258
 
                while (ngw--)
259
 
                {
260
 
                    STORE(p);
261
 
                    INTER_NEXT_GROUP(p);
262
 
                }
263
 
                if (endmask)
264
 
                {
265
 
                    INTER_MROP_PREBUILT_MASK(srcpix, p, endmask, p);
266
 
                }
267
 
            }
268
 
        }
269
 
    }
270
 
    DEALLOCATE_LOCAL(pptFree);
271
 
    DEALLOCATE_LOCAL(pwidthFree);
272
 
}