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

« back to all changes in this revision

Viewing changes to iplan2p4/ipltileodd.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
/* $XFree86$ */
 
2
/*
 
3
 * Fill odd tiled rectangles and spans.
 
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: ipltileodd.c,v 1.16 94/04/17 20:29:06 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 "iplmskbits.h"
 
54
#include "iplmergerop.h"
 
55
 
 
56
#define LEFTSHIFT_AMT 0
 
57
 
 
58
#define LastTileBits {\
 
59
    INTER_COPY(bits, tmp); \
 
60
    if (tileEndPart) \
 
61
        INTER_MSKINSM(tileEndMask, 0, pSrc,                     \
 
62
                         ~0, tileEndLeftShift, pSrcLine, bits)  \
 
63
    else \
 
64
        INTER_COPY(pSrc, bits); \
 
65
}
 
66
 
 
67
#define ResetTileBits {\
 
68
    pSrc = pSrcLine; \
 
69
    nlwSrc = widthSrc;\
 
70
    if (tileEndPart) { \
 
71
        if (INTER_PPG - xoff + tileEndPart <= INTER_PPG) {\
 
72
            INTER_COPY(pSrc, bits); INTER_NEXT_GROUP(pSrc); \
 
73
            nlwSrc--; \
 
74
        } else \
 
75
            INTER_MSKINSM(~0, tileEndLeftShift, tmp,            \
 
76
                          ~0, tileEndRightShift, bits, bits);   \
 
77
        xoff = (xoff + xoffStep) & INTER_PIM; \
 
78
        leftShift = xoff << LEFTSHIFT_AMT; \
 
79
        rightShift = INTER_PGSZ - leftShift; \
 
80
    }\
 
81
}
 
82
 
 
83
#define NextTileBits {\
 
84
    if (nlwSrc == 1) {\
 
85
        LastTileBits\
 
86
    } else { \
 
87
        if (nlwSrc == 0) {\
 
88
            ResetTileBits\
 
89
        } \
 
90
        if (nlwSrc == 1) {\
 
91
            LastTileBits\
 
92
        } else {\
 
93
            INTER_COPY(bits, tmp); \
 
94
            INTER_COPY(pSrc, bits); INTER_NEXT_GROUP(pSrc); \
 
95
        }\
 
96
    }\
 
97
    nlwSrc--; \
 
98
}
 
99
 
 
100
void
 
101
INTER_MROP_NAME(iplFillBoxTileOdd) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask)
 
102
    DrawablePtr     pDrawable;
 
103
    int             nBox;       /* number of boxes to fill */
 
104
    register BoxPtr pBox;       /* pointer to list of boxes to fill */
 
105
    PixmapPtr       tile;       /* tile */
 
106
    int             xrot, yrot;
 
107
    int             alu;
 
108
    unsigned long   planemask;
 
109
{
 
110
    int tileWidth;      /* width of tile in pixels */
 
111
    int tileHeight;     /* height of the tile */
 
112
    int widthSrc;
 
113
 
 
114
    int widthDst;       /* width in longwords of the dest pixmap */
 
115
    int w;              /* width of current box */
 
116
    int h;              /* height of current box */
 
117
    INTER_DECLAREG(startmask);
 
118
    INTER_DECLAREG(endmask);/* masks for reggedy bits at either end of line */
 
119
    int nlwMiddle;      /* number of longwords between sides of boxes */
 
120
    int nlwSrc;         /* number of whole longwords in source */
 
121
    
 
122
    register int nlw;   /* loop version of nlwMiddle */
 
123
    int srcy;           /* current tile y position */
 
124
    int srcx;           /* current tile x position */
 
125
    int xoffDst, xoffSrc;
 
126
    int leftShift, rightShift;
 
127
 
 
128
    INTER_MROP_DECLARE_REG()
 
129
 
 
130
    INTER_DECLAREG(*pDstBase);  /* pointer to start of dest */
 
131
    INTER_DECLAREG(*pDstLine);  /* poitner to start of dest box */
 
132
    INTER_DECLAREG(*pSrcBase);  /* pointer to start of source */
 
133
    INTER_DECLAREG(*pSrcLine);  /* pointer to start of source line */
 
134
    INTER_DECLAREG(*pDst);
 
135
    INTER_DECLAREG(*pSrc);
 
136
    INTER_DECLAREGP(bits);
 
137
    INTER_DECLAREGP(tmp);
 
138
    INTER_DECLAREGP(tmp1);
 
139
    register int           nlwPart;
 
140
    int xoffStart, xoff;
 
141
    int leftShiftStart, rightShiftStart, nlwSrcStart;
 
142
    INTER_DECLAREG(tileEndMask);
 
143
    int tileEndLeftShift, tileEndRightShift;
 
144
    int xoffStep;
 
145
    int tileEndPart;
 
146
    int needFirst;
 
147
    unsigned short narrow[2 * INTER_PLANES];
 
148
    INTER_DECLAREG(narrowMask);
 
149
    int     narrowShift;
 
150
    Bool    narrowTile;
 
151
    int     narrowRep;
 
152
 
 
153
    INTER_MROP_INITIALIZE (alu, planemask)
 
154
 
 
155
    tileHeight = tile->drawable.height;
 
156
    tileWidth = tile->drawable.width;
 
157
    widthSrc = tile->devKind / (INTER_PGSZB * INTER_PLANES);
 
158
    narrowTile = FALSE;
 
159
 
 
160
    if (widthSrc == 1)
 
161
    {
 
162
        narrowRep = INTER_PPG / tileWidth;
 
163
        narrowMask = iplendpartial [tileWidth];
 
164
        tileWidth *= narrowRep;
 
165
        narrowShift = tileWidth;
 
166
        tileWidth *= 2;
 
167
        widthSrc = 2;
 
168
        narrowTile = TRUE;
 
169
    }
 
170
    pSrcBase = (unsigned short *)tile->devPrivate.ptr;
 
171
 
 
172
    iplGetGroupWidthAndPointer (pDrawable, widthDst, pDstBase)
 
173
 
 
174
    tileEndPart = tileWidth & INTER_PIM;
 
175
    tileEndMask = iplendpartial[tileEndPart];
 
176
    tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
 
177
    tileEndRightShift = INTER_PGSZ - tileEndLeftShift;
 
178
    xoffStep = INTER_PPG - tileEndPart;
 
179
    /*
 
180
     * current assumptions: tile > 32 bits wide.
 
181
     */
 
182
    while (nBox--)
 
183
    {
 
184
        w = pBox->x2 - pBox->x1;
 
185
        h = pBox->y2 - pBox->y1;
 
186
        modulus (pBox->x1 - xrot, tileWidth, srcx);
 
187
        modulus (pBox->y1 - yrot, tileHeight, srcy);
 
188
        xoffDst = pBox->x1 & INTER_PIM;
 
189
        if (xoffDst + w < INTER_PPG)
 
190
        {
 
191
            INTER_maskpartialbits(pBox->x1, w, startmask);
 
192
            endmask = 0;
 
193
            nlwMiddle = 0;
 
194
        }
 
195
        else
 
196
        {
 
197
            INTER_maskbits (pBox->x1, w, startmask, endmask, nlwMiddle)
 
198
        }
 
199
        pDstLine = pDstBase + (pBox->y1 * widthDst) + 
 
200
                   (pBox->x1 >> INTER_PGSH) * INTER_PLANES;
 
201
        pSrcLine = pSrcBase + (srcy * widthSrc) * INTER_PLANES;
 
202
        xoffSrc = srcx & INTER_PIM;
 
203
        if (xoffSrc >= xoffDst)
 
204
        {
 
205
            xoffStart = xoffSrc - xoffDst;
 
206
            needFirst = 1;
 
207
        }
 
208
        else
 
209
        {
 
210
            xoffStart = INTER_PPG - (xoffDst - xoffSrc);
 
211
            needFirst = 0;
 
212
        }
 
213
        leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
 
214
        rightShiftStart = INTER_PGSZ - leftShiftStart;
 
215
        nlwSrcStart = (widthSrc - (srcx >> INTER_PGSH));
 
216
        while (h--)
 
217
        {
 
218
            /* XXX only works when narrowShift >= INTER_PPG/2 */
 
219
            if (narrowTile)
 
220
            {
 
221
                int tmpnarrowRep;
 
222
                int shift=narrowShift/narrowRep;
 
223
                INTER_ANDMSK(pSrcBase + srcy * INTER_PLANES, narrowMask, tmp);
 
224
                tmpnarrowRep=narrowRep;
 
225
                /* copy tile until its nearly a whole group wide */
 
226
                while (--tmpnarrowRep)
 
227
                    INTER_MSKINSM(~0,0,tmp,~0,shift,tmp,tmp);
 
228
                INTER_MSKINSM(~0, 0, tmp, ~0, narrowShift, tmp, narrow);
 
229
                INTER_MSKINSM(~0, INTER_PPG - narrowShift, tmp,
 
230
                              ~0, 2 * narrowShift - INTER_PPG, tmp, 
 
231
                              narrow + INTER_PLANES); 
 
232
                pSrcLine = narrow;
 
233
            }
 
234
            xoff = xoffStart;
 
235
            leftShift = leftShiftStart;
 
236
            rightShift = rightShiftStart;
 
237
            nlwSrc = nlwSrcStart;
 
238
            pSrc = pSrcLine + (srcx >> INTER_PGSH) * INTER_PLANES;
 
239
            pDst = pDstLine;
 
240
            INTER_CLR(bits);
 
241
            if (needFirst)
 
242
            {
 
243
                NextTileBits
 
244
            }
 
245
            if (startmask)
 
246
            {
 
247
                NextTileBits
 
248
                INTER_SCRLEFT(leftShift, tmp, tmp);
 
249
                if (rightShift != INTER_PGSZ)
 
250
                    INTER_MSKINSM(~0, 0, tmp, ~0, rightShift, bits, tmp)
 
251
                INTER_MROP_MASK (tmp, pDst, startmask, pDst);
 
252
                INTER_NEXT_GROUP(pDst);
 
253
            }
 
254
            nlw = nlwMiddle;
 
255
            while (nlw)
 
256
            {
 
257
                {
 
258
                    NextTileBits
 
259
                    if (rightShift != INTER_PGSZ)
 
260
                    {
 
261
                        INTER_MSKINSM(~0, leftShift, tmp, ~0, rightShift, bits, 
 
262
                                  tmp1);
 
263
                        INTER_MROP_SOLID(tmp1, pDst, pDst);
 
264
                    }
 
265
                    else
 
266
                    {
 
267
                        INTER_MROP_SOLID (tmp, pDst, pDst);
 
268
                    }
 
269
                    INTER_NEXT_GROUP(pDst);
 
270
                    nlw--;
 
271
                }
 
272
            }
 
273
            if (endmask)
 
274
            {
 
275
                NextTileBits
 
276
                if (rightShift == INTER_PGSZ)
 
277
                    INTER_CLR(bits);
 
278
                INTER_MSKINSM(~0, leftShift, tmp, ~0, rightShift, bits, tmp1);
 
279
                INTER_MROP_MASK(tmp1, pDst, endmask, pDst);
 
280
            }
 
281
            pDstLine += widthDst;
 
282
            pSrcLine += widthSrc * INTER_PLANES;
 
283
            if (++srcy == tileHeight)
 
284
            {
 
285
                srcy = 0;
 
286
                pSrcLine = pSrcBase;
 
287
            }
 
288
        }
 
289
        pBox++;
 
290
    }
 
291
}
 
292
 
 
293
void
 
294
INTER_MROP_NAME(iplFillSpanTileOdd) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask)
 
295
    DrawablePtr pDrawable;
 
296
    int         n;
 
297
    DDXPointPtr ppt;
 
298
    int         *pwidth;
 
299
    PixmapPtr   tile;
 
300
    int         xrot, yrot;
 
301
    int         alu;
 
302
    unsigned long   planemask;
 
303
{
 
304
    int tileWidth;      /* width of tile in pixels */
 
305
    int tileHeight;     /* height of the tile */
 
306
    int widthSrc;
 
307
 
 
308
    int widthDst;               /* width in longwords of the dest pixmap */
 
309
    int w;              /* width of current span */
 
310
    INTER_DECLAREG(startmask);
 
311
    INTER_DECLAREG (endmask);   /* masks for reggedy bits at either end of line */
 
312
    int nlwSrc;         /* number of whole longwords in source */
 
313
    
 
314
    register int nlw;   /* loop version of nlwMiddle */
 
315
    int srcy;           /* current tile y position */
 
316
    int srcx;           /* current tile x position */
 
317
    int xoffDst, xoffSrc;
 
318
    int leftShift, rightShift;
 
319
 
 
320
    INTER_MROP_DECLARE_REG()
 
321
 
 
322
    INTER_DECLAREG(*pDstBase);  /* pointer to start of dest */
 
323
    INTER_DECLAREG(*pDstLine);  /* poitner to start of dest box */
 
324
    INTER_DECLAREG(*pSrcBase);  /* pointer to start of source */
 
325
    INTER_DECLAREG(*pSrcLine);  /* pointer to start of source line */
 
326
    INTER_DECLAREG(*pDst);
 
327
    INTER_DECLAREG(*pSrc);
 
328
    INTER_DECLAREGP(bits);
 
329
    INTER_DECLAREGP(tmp);
 
330
    INTER_DECLAREGP(tmp1);
 
331
    register int           nlwPart;
 
332
    int xoffStart, xoff;
 
333
    int leftShiftStart, rightShiftStart, nlwSrcStart;
 
334
    INTER_DECLAREG(tileEndMask);
 
335
    int tileEndLeftShift, tileEndRightShift;
 
336
    int xoffStep;
 
337
    int tileEndPart;
 
338
    int needFirst;
 
339
    unsigned short narrow[2 * INTER_PLANES];
 
340
    INTER_DECLAREG(narrowMask);
 
341
    int     narrowShift;
 
342
    Bool    narrowTile;
 
343
    int     narrowRep;
 
344
 
 
345
    INTER_MROP_INITIALIZE (alu, planemask)
 
346
 
 
347
    tileHeight = tile->drawable.height;
 
348
    tileWidth = tile->drawable.width;
 
349
    widthSrc = tile->devKind / (INTER_PGSZB * INTER_PLANES);
 
350
    narrowTile = FALSE;
 
351
    if (widthSrc == 1)
 
352
    {
 
353
        narrowRep = INTER_PPG / tileWidth;
 
354
        narrowMask = iplendpartial [tileWidth];
 
355
        tileWidth *= narrowRep;
 
356
        narrowShift = tileWidth;
 
357
        tileWidth *= 2;
 
358
        widthSrc = 2;
 
359
        narrowTile = TRUE;
 
360
    }
 
361
    pSrcBase = (unsigned short *)tile->devPrivate.ptr;
 
362
 
 
363
    iplGetGroupWidthAndPointer (pDrawable, widthDst, pDstBase)
 
364
 
 
365
    tileEndPart = tileWidth & INTER_PIM;
 
366
    tileEndMask = iplendpartial[tileEndPart];
 
367
    tileEndLeftShift = (tileEndPart) << LEFTSHIFT_AMT;
 
368
    tileEndRightShift = INTER_PGSZ - tileEndLeftShift;
 
369
    xoffStep = INTER_PPG - tileEndPart;
 
370
    while (n--)
 
371
    {
 
372
        w = *pwidth++;
 
373
        modulus (ppt->x - xrot, tileWidth, srcx);
 
374
        modulus (ppt->y - yrot, tileHeight, srcy);
 
375
        xoffDst = ppt->x & INTER_PIM;
 
376
        if (xoffDst + w < INTER_PPG)
 
377
        {
 
378
            INTER_maskpartialbits(ppt->x, w, startmask);
 
379
            endmask = 0;
 
380
            nlw = 0;
 
381
        }
 
382
        else
 
383
        {
 
384
            INTER_maskbits (ppt->x, w, startmask, endmask, nlw)
 
385
        }
 
386
        pDstLine = pDstBase + (ppt->y * widthDst) + 
 
387
                   (ppt->x >> INTER_PGSH) * INTER_PLANES;
 
388
        pSrcLine = pSrcBase + (srcy * widthSrc) * INTER_PLANES;
 
389
        xoffSrc = srcx & INTER_PIM;
 
390
        if (xoffSrc >= xoffDst)
 
391
        {
 
392
            xoffStart = xoffSrc - xoffDst;
 
393
            needFirst = 1;
 
394
        }
 
395
        else
 
396
        {
 
397
            xoffStart = INTER_PPG - (xoffDst - xoffSrc);
 
398
            needFirst = 0;
 
399
        }
 
400
        leftShiftStart = (xoffStart) << LEFTSHIFT_AMT;
 
401
        rightShiftStart = INTER_PGSZ - leftShiftStart;
 
402
        nlwSrcStart = widthSrc - (srcx >> INTER_PGSH);
 
403
        /* XXX only works when narrowShift >= INTER_PPG/2 */
 
404
        if (narrowTile)
 
405
        {
 
406
            int tmpnarrowRep;
 
407
            int shift=narrowShift/narrowRep;
 
408
            INTER_ANDMSK(pSrcBase + srcy * INTER_PLANES, narrowMask, tmp);
 
409
            tmpnarrowRep=narrowRep;
 
410
            /* copy tile until its nearly a whole group wide */
 
411
            while (--tmpnarrowRep)
 
412
                INTER_MSKINSM(~0,0,tmp,~0,shift,tmp,tmp);
 
413
            INTER_MSKINSM(~0, 0, tmp, ~0, narrowShift, tmp, narrow);
 
414
            INTER_MSKINSM(~0, INTER_PPG - narrowShift, tmp,
 
415
                              ~0, 2 * narrowShift - INTER_PPG, tmp, 
 
416
                              narrow + INTER_PLANES); 
 
417
            pSrcLine = narrow;
 
418
        }
 
419
        xoff = xoffStart;
 
420
        leftShift = leftShiftStart;
 
421
        rightShift = rightShiftStart;
 
422
        nlwSrc = nlwSrcStart;
 
423
        pSrc = pSrcLine + (srcx >> INTER_PGSH) * INTER_PLANES;
 
424
        pDst = pDstLine;
 
425
        INTER_CLR(bits);
 
426
        if (needFirst)
 
427
        {
 
428
            NextTileBits
 
429
        }
 
430
        if (startmask)
 
431
        {
 
432
            NextTileBits
 
433
            INTER_SCRLEFT(leftShift, tmp, tmp);
 
434
            if (rightShift != INTER_PGSZ)
 
435
                INTER_MSKINSM(~0, 0, tmp, ~0, rightShift, bits, tmp);
 
436
            INTER_MROP_MASK (tmp, pDst, startmask, pDst);
 
437
            INTER_NEXT_GROUP(pDst);
 
438
        }
 
439
        while (nlw)
 
440
        {
 
441
            {
 
442
                NextTileBits
 
443
                if (rightShift != INTER_PGSZ)
 
444
                {
 
445
                    INTER_MSKINSM(~0, leftShift, tmp, ~0, rightShift, bits, 
 
446
                                  tmp1);
 
447
                    INTER_MROP_SOLID(tmp1, pDst, pDst);
 
448
                    INTER_NEXT_GROUP(pDst);
 
449
                }
 
450
                else
 
451
                {
 
452
                    INTER_MROP_SOLID (tmp, pDst, pDst);
 
453
                    INTER_NEXT_GROUP(pDst);
 
454
                }
 
455
                nlw--;
 
456
            }
 
457
        }
 
458
        if (endmask)
 
459
        {
 
460
            NextTileBits
 
461
            if (rightShift == INTER_PGSZ)
 
462
                INTER_CLR(bits);
 
463
            
 
464
            INTER_MSKINSM(~0, leftShift, tmp, ~0, rightShift, bits, tmp1);
 
465
            INTER_MROP_MASK(tmp1, pDst, endmask, pDst);
 
466
        }
 
467
        ppt++;
 
468
    }
 
469
}
 
470
 
 
471
# include "fastblt.h"
 
472
 
 
473
#define IncSrcPtr   INTER_NEXT_GROUP(psrc); if (!--srcRemaining) { srcRemaining = widthSrc; psrc = psrcStart; }
 
474
 
 
475
void
 
476
INTER_MROP_NAME(iplFillBoxTile32s) (pDrawable, nBox, pBox, tile, xrot, yrot, alu, planemask)
 
477
    DrawablePtr     pDrawable;
 
478
    int             nBox;       /* number of boxes to fill */
 
479
    register BoxPtr pBox;       /* pointer to list of boxes to fill */
 
480
    PixmapPtr       tile;       /* tile */
 
481
    int             xrot, yrot;
 
482
    int             alu;
 
483
    unsigned long   planemask;
 
484
{
 
485
    int tileWidth;      /* width of tile */
 
486
    int tileHeight;     /* height of the tile */
 
487
    int widthSrc;       /* width in longwords of the source tile */
 
488
 
 
489
    int widthDst;       /* width in longwords of the dest pixmap */
 
490
    int w;              /* width of current box */
 
491
    int h;              /* height of current box */
 
492
    INTER_DECLAREG(startmask);
 
493
    INTER_DECLAREG(endmask); /* masks for reggedy bits at either end of line */
 
494
    int nlMiddle;       /* number of longwords between sides of boxes */
 
495
    
 
496
    register int nl;    /* loop version of nlMiddle */
 
497
    int srcy;           /* current tile y position */
 
498
    int srcx;           /* current tile x position */
 
499
    int srcRemaining;   /* number of longwords remaining in source */
 
500
    int xoffDst, xoffSrc;
 
501
    int srcStart;       /* number of longwords source offset at left of box */
 
502
    int leftShift, rightShift;
 
503
 
 
504
    INTER_MROP_DECLARE_REG()
 
505
 
 
506
    INTER_DECLAREG(*pdstBase);  /* pointer to start of dest */
 
507
    INTER_DECLAREG(*pdstLine);  /* poitner to start of dest box */
 
508
    INTER_DECLAREG(*psrcBase);  /* pointer to start of source */
 
509
    INTER_DECLAREG(*psrcLine);  /* pointer to fetch point of source */
 
510
    INTER_DECLAREG(*psrcStart); /* pointer to start of source line */
 
511
    INTER_DECLAREG(*pdst);
 
512
    INTER_DECLAREG(*psrc);
 
513
    INTER_DECLAREGP(bits);
 
514
    INTER_DECLAREGP(bits1);
 
515
    register int            nlTemp;
 
516
 
 
517
    INTER_MROP_INITIALIZE (alu, planemask)
 
518
 
 
519
    psrcBase = (unsigned short *)tile->devPrivate.ptr;
 
520
    tileHeight = tile->drawable.height;
 
521
    tileWidth = tile->drawable.width;
 
522
    widthSrc = tile->devKind / (INTER_PGSZB * INTER_PLANES);
 
523
 
 
524
    iplGetGroupWidthAndPointer (pDrawable, widthDst, pdstBase)
 
525
 
 
526
    while (nBox--)
 
527
    {
 
528
        w = pBox->x2 - pBox->x1;
 
529
        h = pBox->y2 - pBox->y1;
 
530
 
 
531
        /* set up source */
 
532
        modulus (pBox->x1 - xrot, tileWidth, srcx);
 
533
        modulus (pBox->y1 - yrot, tileHeight, srcy);
 
534
        xoffSrc = srcx & INTER_PIM;
 
535
        srcStart = srcx >> INTER_PGSH;
 
536
        psrcStart = psrcBase + (srcy * widthSrc) * INTER_PLANES;
 
537
        psrcLine = psrcStart + srcStart * INTER_PLANES;
 
538
 
 
539
        /* set up dest */
 
540
        xoffDst = pBox->x1 & INTER_PIM;
 
541
        pdstLine = pdstBase + (pBox->y1 * widthDst) + 
 
542
                (pBox->x1 >> INTER_PGSH) * INTER_PLANES;
 
543
        /* set up masks */
 
544
        if (xoffDst + w < INTER_PPG)
 
545
        {
 
546
            INTER_maskpartialbits(pBox->x1, w, startmask);
 
547
            endmask = 0;
 
548
            nlMiddle = 0;
 
549
        }
 
550
        else
 
551
        {
 
552
            INTER_maskbits (pBox->x1, w, startmask, endmask, nlMiddle)
 
553
        }
 
554
        if (xoffSrc == xoffDst)
 
555
        {
 
556
            while (h--)
 
557
            {
 
558
                psrc = psrcLine;
 
559
                pdst = pdstLine;
 
560
                srcRemaining = widthSrc - srcStart;
 
561
                if (startmask)
 
562
                {
 
563
                    INTER_MROP_MASK (psrc, pdst, startmask, pdst);
 
564
                    INTER_NEXT_GROUP(pdst);
 
565
                    IncSrcPtr
 
566
                }
 
567
                nlTemp = nlMiddle;
 
568
                while (nlTemp)
 
569
                {
 
570
                    nl = nlTemp;
 
571
                    if (nl > srcRemaining)
 
572
                        nl = srcRemaining;
 
573
 
 
574
                    nlTemp -= nl;
 
575
                    srcRemaining -= nl;
 
576
 
 
577
                    while (nl--) {
 
578
                            INTER_MROP_SOLID (psrc, pdst, pdst);
 
579
                            INTER_NEXT_GROUP(pdst); INTER_NEXT_GROUP(psrc);
 
580
                    }
 
581
 
 
582
                    if (!srcRemaining)
 
583
                    {
 
584
                        srcRemaining = widthSrc;
 
585
                        psrc = psrcStart;
 
586
                    }
 
587
                }
 
588
                if (endmask)
 
589
                {
 
590
                    INTER_MROP_MASK (psrc, pdst, endmask, pdst);
 
591
                }
 
592
                pdstLine += widthDst;
 
593
                psrcLine += widthSrc * INTER_PLANES;
 
594
                psrcStart += widthSrc * INTER_PLANES;
 
595
                if (++srcy == tileHeight)
 
596
                {
 
597
                    psrcStart = psrcBase;
 
598
                    psrcLine = psrcStart + srcStart * INTER_PLANES;
 
599
                    srcy = 0;
 
600
                }
 
601
            }
 
602
        }
 
603
        else
 
604
        {
 
605
            if (xoffSrc > xoffDst)
 
606
            {
 
607
                leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT;
 
608
                rightShift = INTER_PGSZ - leftShift;
 
609
            }
 
610
            else
 
611
            {
 
612
                rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT;
 
613
                leftShift = INTER_PGSZ - rightShift;
 
614
            }
 
615
            while (h--)
 
616
            {
 
617
                psrc = psrcLine;
 
618
                pdst = pdstLine;
 
619
                INTER_CLR(bits);
 
620
                srcRemaining = widthSrc - srcStart;
 
621
                if (xoffSrc > xoffDst)
 
622
                {
 
623
                    INTER_COPY(psrc, bits);
 
624
                    IncSrcPtr
 
625
                }
 
626
                if (startmask)
 
627
                {
 
628
                    INTER_SCRLEFT(leftShift, bits, bits1);
 
629
                    INTER_COPY(psrc, bits);
 
630
                    IncSrcPtr
 
631
                    INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
 
632
                    INTER_MROP_MASK(bits1, pdst, startmask, pdst);
 
633
                    INTER_NEXT_GROUP(pdst);
 
634
                }
 
635
                nlTemp = nlMiddle;
 
636
                while (nlTemp)
 
637
                {
 
638
                    nl = nlTemp;
 
639
                    if (nl > srcRemaining)
 
640
                        nl = srcRemaining;
 
641
 
 
642
                    nlTemp -= nl;
 
643
                    srcRemaining -= nl;
 
644
    
 
645
                    while (nl--) {
 
646
                        INTER_SCRLEFT(leftShift, bits, bits1);
 
647
                        INTER_COPY(psrc, bits); INTER_NEXT_GROUP(psrc);
 
648
                        INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
 
649
                        INTER_MROP_SOLID (bits1, pdst, pdst);
 
650
                        INTER_NEXT_GROUP(pdst);
 
651
                    }
 
652
 
 
653
                    if (!srcRemaining)
 
654
                    {
 
655
                        srcRemaining = widthSrc;
 
656
                        psrc = psrcStart;
 
657
                    }
 
658
                }
 
659
 
 
660
                if (endmask)
 
661
                {
 
662
                    INTER_SCRLEFT(leftShift, bits, bits1);
 
663
                    if (endmask << rightShift)
 
664
                    {
 
665
                        INTER_COPY(psrc, bits);
 
666
                        INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
 
667
                    }
 
668
                    INTER_MROP_MASK (bits1, pdst, endmask, pdst);
 
669
                }
 
670
                pdstLine += widthDst;
 
671
                psrcLine += widthSrc * INTER_PLANES;
 
672
                psrcStart += widthSrc * INTER_PLANES;
 
673
                if (++srcy == tileHeight)
 
674
                {
 
675
                    psrcStart = psrcBase;
 
676
                    psrcLine = psrcStart + srcStart * INTER_PLANES;
 
677
                    srcy = 0;
 
678
                }
 
679
            }
 
680
        }
 
681
        pBox++;
 
682
    }
 
683
}
 
684
 
 
685
void
 
686
INTER_MROP_NAME(iplFillSpanTile32s) (pDrawable, n, ppt, pwidth, tile, xrot, yrot, alu, planemask)
 
687
    DrawablePtr pDrawable;
 
688
    int         n;
 
689
    DDXPointPtr ppt;
 
690
    int         *pwidth;
 
691
    PixmapPtr   tile;
 
692
    int         xrot, yrot;
 
693
    int         alu;
 
694
    unsigned long   planemask;
 
695
{
 
696
    int tileWidth;      /* width of tile */
 
697
    int tileHeight;     /* height of the tile */
 
698
    int widthSrc;       /* width in longwords of the source tile */
 
699
 
 
700
    int widthDst;       /* width in longwords of the dest pixmap */
 
701
    int w;              /* width of current box */
 
702
    INTER_DECLAREG(startmask);
 
703
    INTER_DECLAREG(endmask);/* masks for reggedy bits at either end of line */
 
704
    int nlMiddle;       /* number of longwords between sides of boxes */
 
705
    
 
706
    register int nl;    /* loop version of nlMiddle */
 
707
    int srcy;           /* current tile y position */
 
708
    int srcx;           /* current tile x position */
 
709
    int srcRemaining;   /* number of longwords remaining in source */
 
710
    int xoffDst, xoffSrc;
 
711
    int srcStart;       /* number of longwords source offset at left of box */
 
712
    int leftShift, rightShift;
 
713
 
 
714
    INTER_MROP_DECLARE_REG()
 
715
 
 
716
    INTER_DECLAREG(*pdstBase);  /* pointer to start of dest */
 
717
    INTER_DECLAREG(*pdstLine);  /* poitner to start of dest box */
 
718
    INTER_DECLAREG(*psrcBase);  /* pointer to start of source */
 
719
    INTER_DECLAREG(*psrcLine);  /* pointer to fetch point of source */
 
720
    INTER_DECLAREG(*psrcStart); /* pointer to start of source line */
 
721
    INTER_DECLAREG(*pdst);
 
722
    INTER_DECLAREG(*psrc);
 
723
    INTER_DECLAREGP(bits);
 
724
    INTER_DECLAREGP(bits1);
 
725
    register int            nlTemp;
 
726
 
 
727
    INTER_MROP_INITIALIZE (alu, planemask)
 
728
 
 
729
    psrcBase = (unsigned short *)tile->devPrivate.ptr;
 
730
    tileHeight = tile->drawable.height;
 
731
    tileWidth = tile->drawable.width;
 
732
    widthSrc = tile->devKind / (INTER_PGSZB * INTER_PLANES);
 
733
 
 
734
    iplGetGroupWidthAndPointer (pDrawable, widthDst, pdstBase)
 
735
 
 
736
    while (n--)
 
737
    {
 
738
        w = *pwidth++;
 
739
 
 
740
        /* set up source */
 
741
        modulus (ppt->x - xrot, tileWidth, srcx);
 
742
        modulus (ppt->y - yrot, tileHeight, srcy);
 
743
        xoffSrc = srcx & INTER_PIM;
 
744
        srcStart = srcx >> INTER_PGSH;
 
745
        psrcStart = psrcBase + (srcy * widthSrc) * INTER_PLANES;
 
746
        psrcLine = psrcStart + srcStart * INTER_PLANES;
 
747
 
 
748
        /* set up dest */
 
749
        xoffDst = ppt->x & INTER_PIM;
 
750
        pdstLine = pdstBase + (ppt->y * widthDst) + 
 
751
                (ppt->x >> INTER_PGSH) * INTER_PLANES;
 
752
        /* set up masks */
 
753
        if (xoffDst + w < INTER_PPG)
 
754
        {
 
755
            INTER_maskpartialbits(ppt->x, w, startmask);
 
756
            endmask = 0;
 
757
            nlMiddle = 0;
 
758
        }
 
759
        else
 
760
        {
 
761
            INTER_maskbits (ppt->x, w, startmask, endmask, nlMiddle)
 
762
        }
 
763
 
 
764
        if (xoffSrc == xoffDst)
 
765
        {
 
766
            psrc = psrcLine;
 
767
            pdst = pdstLine;
 
768
            srcRemaining = widthSrc - srcStart;
 
769
            if (startmask)
 
770
            {
 
771
                INTER_MROP_MASK (psrc, pdst, startmask, pdst);
 
772
                INTER_NEXT_GROUP(pdst);
 
773
                IncSrcPtr
 
774
            }
 
775
            nlTemp = nlMiddle;
 
776
            while (nlTemp)
 
777
            {
 
778
                nl = nlTemp;
 
779
                if (nl > srcRemaining)
 
780
                    nl = srcRemaining;
 
781
 
 
782
                nlTemp -= nl;
 
783
                srcRemaining -= nl;
 
784
 
 
785
                while (nl--) {
 
786
                        INTER_MROP_SOLID (psrc, pdst, pdst);
 
787
                        INTER_NEXT_GROUP(pdst); INTER_NEXT_GROUP(psrc);
 
788
                }
 
789
 
 
790
                if (!srcRemaining)
 
791
                {
 
792
                    srcRemaining = widthSrc;
 
793
                    psrc = psrcStart;
 
794
                }
 
795
            }
 
796
            if (endmask)
 
797
            {
 
798
                INTER_MROP_MASK (psrc, pdst, endmask, pdst);
 
799
            }
 
800
        }
 
801
        else
 
802
        {
 
803
            if (xoffSrc > xoffDst)
 
804
            {
 
805
                leftShift = (xoffSrc - xoffDst) << LEFTSHIFT_AMT;
 
806
                rightShift = INTER_PGSZ - leftShift;
 
807
            }
 
808
            else
 
809
            {
 
810
                rightShift = (xoffDst - xoffSrc) << LEFTSHIFT_AMT;
 
811
                leftShift = INTER_PGSZ - rightShift;
 
812
            }
 
813
            psrc = psrcLine;
 
814
            pdst = pdstLine;
 
815
            INTER_CLR(bits);
 
816
            srcRemaining = widthSrc - srcStart;
 
817
            if (xoffSrc > xoffDst)
 
818
            {
 
819
                INTER_COPY(psrc, bits);
 
820
                IncSrcPtr
 
821
            }
 
822
            if (startmask)
 
823
            {
 
824
                INTER_SCRLEFT(leftShift, bits, bits1);
 
825
                INTER_COPY(psrc, bits);
 
826
                IncSrcPtr
 
827
                INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
 
828
                INTER_MROP_MASK(bits1, pdst, startmask, pdst);
 
829
                INTER_NEXT_GROUP(pdst);
 
830
            }
 
831
            nlTemp = nlMiddle;
 
832
            while (nlTemp)
 
833
            {
 
834
                nl = nlTemp;
 
835
                if (nl > srcRemaining)
 
836
                    nl = srcRemaining;
 
837
 
 
838
                nlTemp -= nl;
 
839
                srcRemaining -= nl;
 
840
 
 
841
                while (nl--) {
 
842
                    INTER_SCRLEFT(leftShift, bits, bits1);
 
843
                    INTER_COPY(psrc, bits); INTER_NEXT_GROUP(psrc);
 
844
                    INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
 
845
                    INTER_MROP_SOLID(bits1, pdst, pdst);
 
846
                    INTER_NEXT_GROUP(pdst);
 
847
                }
 
848
 
 
849
                if (!srcRemaining)
 
850
                {
 
851
                    srcRemaining = widthSrc;
 
852
                    psrc = psrcStart;
 
853
                }
 
854
            }
 
855
 
 
856
            if (endmask)
 
857
            {
 
858
                INTER_SCRLEFT(leftShift, bits, bits1);
 
859
                if (endmask << rightShift)
 
860
                {
 
861
                    INTER_COPY(psrc, bits);
 
862
                    INTER_MSKINSM(~0, 0, bits1, ~0, rightShift, bits, bits1);
 
863
                }
 
864
                INTER_MROP_MASK (bits1, pdst, endmask, pdst);
 
865
            }
 
866
        }
 
867
        ppt++;
 
868
    }
 
869
}