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

« back to all changes in this revision

Viewing changes to ilbm/ilbmblt.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
 
 * ilbm copy area
4
 
 */
5
 
 
6
 
/*
7
 
 
8
 
Copyright (c) 1989  X Consortium
9
 
 
10
 
Permission is hereby granted, free of charge, to any person obtaining a copy
11
 
of this software and associated documentation files (the "Software"), to deal
12
 
in the Software without restriction, including without limitation the rights
13
 
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
 
copies of the Software, and to permit persons to whom the Software is
15
 
furnished to do so, subject to the following conditions:
16
 
 
17
 
The above copyright notice and this permission notice shall be included in
18
 
all copies or substantial portions of the Software.
19
 
 
20
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
 
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
23
 
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
24
 
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
25
 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
 
 
27
 
Except as contained in this notice, the name of the X Consortium shall not be
28
 
used in advertising or otherwise to promote the sale, use or other dealings
29
 
in this Software without prior written authorization from the X Consortium.
30
 
 
31
 
Author: Keith Packard
32
 
 
33
 
*/
34
 
/* $XConsortium: ilbmblt.c,v 1.11 94/04/17 20:28:16 dpw Exp $ */
35
 
 
36
 
/* Modified jun 95 by Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
37
 
   to use interleaved bitplanes instead of normal bitplanes */
38
 
 
39
 
#ifdef HAVE_DIX_CONFIG_H
40
 
#include <dix-config.h>
41
 
#endif
42
 
 
43
 
#include <X11/X.h>
44
 
#include <X11/Xmd.h>
45
 
#include <X11/Xproto.h>
46
 
#include "ilbm.h"
47
 
#include "gcstruct.h"
48
 
#include "windowstr.h"
49
 
#include "scrnintstr.h"
50
 
#include "pixmapstr.h"
51
 
#include "regionstr.h"
52
 
#include "maskbits.h"
53
 
#include "fastblt.h"
54
 
#include "mergerop.h"
55
 
 
56
 
void
57
 
MROP_NAME(ilbmDoBitblt)(pSrc, pDst, alu, prgnDst, pptSrc, planemask)
58
 
        DrawablePtr pSrc, pDst;
59
 
        int alu;
60
 
        RegionPtr prgnDst;
61
 
        DDXPointPtr pptSrc;
62
 
        unsigned long planemask;
63
 
{
64
 
        PixelType *psrcBase, *pdstBase; /* start of src and dst bitmaps */
65
 
        int widthSrc, widthDst;                 /* add to get to same position in next line */
66
 
        int heightSrc, heightDst;
67
 
        int auxSrc, auxDst;
68
 
 
69
 
        BoxPtr pbox;
70
 
        int nbox;
71
 
 
72
 
        BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2;
73
 
                                                                                                /* temporaries for shuffling rectangles */
74
 
        DDXPointPtr pptTmp, pptNew1, pptNew2;
75
 
                                                                                                /* shuffling boxes entails shuffling the
76
 
                                                                                                        source points too */
77
 
        int w, h;
78
 
        int xdir;                                               /* 1 = left right, -1 = right left/ */
79
 
        int ydir;                                               /* 1 = top down, -1 = bottom up */
80
 
 
81
 
        PixelType *psrcLine, *pdstLine;
82
 
                                                                                /* pointers to line with current src and dst */
83
 
        register PixelType *psrc;       /* pointer to current src longword */
84
 
        register PixelType *pdst;       /* pointer to current dst longword */
85
 
 
86
 
        MROP_DECLARE_REG()
87
 
 
88
 
                                                                                /* following used for looping through a line */
89
 
        PixelType startmask, endmask;           /* masks for writing ends of dst */
90
 
        int nlMiddle;                                   /* whole longwords in dst */
91
 
        int xoffSrc, xoffDst;
92
 
        register int leftShift, rightShift;
93
 
        register PixelType bits;
94
 
        register PixelType bits1;
95
 
        register int nl;                                /* temp copy of nlMiddle */
96
 
 
97
 
                                                                                /* place to store full source word */
98
 
        int nstart;                                             /* number of ragged bits at start of dst */
99
 
        int nend;                                               /* number of ragged bits at end of dst */
100
 
        int srcStartOver;                               /* pulling nstart bits from src
101
 
                                                                                        overflows into the next word? */
102
 
        int careful;
103
 
        int tmpSrc;
104
 
        int depthSrc;
105
 
        int depthDst;
106
 
 
107
 
        MROP_INITIALIZE(alu,0);
108
 
 
109
 
        ilbmGetPixelWidthAuxDepthAndPointer(pSrc, widthSrc, auxSrc, depthSrc,
110
 
                                                                                                        psrcBase);
111
 
        ilbmGetPixelWidthAuxDepthAndPointer(pDst, widthDst, auxDst, depthDst,
112
 
                                                                                                        pdstBase);
113
 
 
114
 
        /* Special case where depth of dest pixmap is 1 but source pixmap isn't
115
 
         * Used for GetImage to copy a plane from a source pixmap to a particular
116
 
         * dest pixmap plane.
117
 
         * Note: planemask should have only one bit set or several planes from
118
 
         * the source will be copied to the same dest plane.
119
 
         */
120
 
        if (depthDst == 1 && depthDst != depthSrc)
121
 
                widthDst = 0;
122
 
 
123
 
        /* XXX we have to err on the side of safety when both are windows,
124
 
         * because we don't know if IncludeInferiors is being used.
125
 
         */
126
 
        careful = ((pSrc == pDst) ||
127
 
                                  ((pSrc->type == DRAWABLE_WINDOW) &&
128
 
                                        (pDst->type == DRAWABLE_WINDOW)));
129
 
 
130
 
        pbox = REGION_RECTS(prgnDst);
131
 
        nbox = REGION_NUM_RECTS(prgnDst);
132
 
 
133
 
        pboxNew1 = NULL;
134
 
        pptNew1 = NULL;
135
 
        pboxNew2 = NULL;
136
 
        pptNew2 = NULL;
137
 
        if (careful && (pptSrc->y < pbox->y1)) {
138
 
                /* walk source botttom to top */
139
 
                ydir = -1;
140
 
                auxSrc = -auxSrc;
141
 
                auxDst = -auxDst;
142
 
 
143
 
                if (nbox > 1) {
144
 
                        /* keep ordering in each band, reverse order of bands */
145
 
                        pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox);
146
 
                        if (!pboxNew1)
147
 
                                return;
148
 
                        pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox);
149
 
                        if (!pptNew1) {
150
 
                                DEALLOCATE_LOCAL(pboxNew1);
151
 
                                return;
152
 
                        }
153
 
                        pboxBase = pboxNext = pbox+nbox-1;
154
 
                        while (pboxBase >= pbox) {
155
 
                                while ((pboxNext >= pbox) &&
156
 
                                           (pboxBase->y1 == pboxNext->y1))
157
 
                                        pboxNext--;
158
 
                                pboxTmp = pboxNext+1;
159
 
                                pptTmp = pptSrc + (pboxTmp - pbox);
160
 
                                while (pboxTmp <= pboxBase) {
161
 
                                        *pboxNew1++ = *pboxTmp++;
162
 
                                        *pptNew1++ = *pptTmp++;
163
 
                                }
164
 
                                pboxBase = pboxNext;
165
 
                        }
166
 
                        pboxNew1 -= nbox;
167
 
                        pbox = pboxNew1;
168
 
                        pptNew1 -= nbox;
169
 
                        pptSrc = pptNew1;
170
 
                }
171
 
        } else {
172
 
                /* walk source top to bottom */
173
 
                ydir = 1;
174
 
        }
175
 
 
176
 
        if (careful && (pptSrc->x < pbox->x1)) {
177
 
                /* walk source right to left */
178
 
                xdir = -1;
179
 
 
180
 
                if (nbox > 1) {
181
 
                        /* reverse order of rects in each band */
182
 
                        pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec) * nbox);
183
 
                        pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec) * nbox);
184
 
                        if (!pboxNew2 || !pptNew2) {
185
 
                                if (pptNew2)
186
 
                                        DEALLOCATE_LOCAL(pptNew2);
187
 
                                if (pboxNew2)
188
 
                                        DEALLOCATE_LOCAL(pboxNew2);
189
 
                                if (pboxNew1) {
190
 
                                        DEALLOCATE_LOCAL(pptNew1);
191
 
                                        DEALLOCATE_LOCAL(pboxNew1);
192
 
                                }
193
 
                                return;
194
 
                        }
195
 
                        pboxBase = pboxNext = pbox;
196
 
                        while (pboxBase < pbox+nbox) {
197
 
                                while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1))
198
 
                                        pboxNext++;
199
 
                                pboxTmp = pboxNext;
200
 
                                pptTmp = pptSrc + (pboxTmp - pbox);
201
 
                                while (pboxTmp != pboxBase) {
202
 
                                        *pboxNew2++ = *--pboxTmp;
203
 
                                        *pptNew2++ = *--pptTmp;
204
 
                                }
205
 
                                pboxBase = pboxNext;
206
 
                        }
207
 
                        pboxNew2 -= nbox;
208
 
                        pbox = pboxNew2;
209
 
                        pptNew2 -= nbox;
210
 
                        pptSrc = pptNew2;
211
 
                }
212
 
        } else {
213
 
                /* walk source left to right */
214
 
                xdir = 1;
215
 
        }
216
 
 
217
 
        while (nbox--) {
218
 
                int d;
219
 
                for (d = 0; d < depthSrc; d++) {
220
 
                        PixelType *psrcB;
221
 
                        PixelType *pdstB;
222
 
 
223
 
                        if (!(planemask & (1 << d)))
224
 
                                continue;
225
 
 
226
 
                        psrcB = psrcBase + widthSrc * d;                        /* @@@ NEXT PLANE @@@ */
227
 
                        pdstB = pdstBase + widthDst * d;                        /* @@@ NEXT PLANE @@@ */
228
 
 
229
 
                        w = pbox->x2 - pbox->x1;
230
 
                        h = pbox->y2 - pbox->y1;
231
 
 
232
 
                        if (ydir == -1) { /* start at last scanline of rectangle */
233
 
                                psrcLine = ilbmScanlineDeltaSrc(psrcB, -(pptSrc->y+h-1), auxSrc);
234
 
                                pdstLine = ilbmScanlineDeltaDst(pdstB, -(pbox->y2-1), auxDst);
235
 
                        } else { /* start at first scanline */
236
 
                                psrcLine = ilbmScanlineDeltaSrc(psrcB, pptSrc->y, auxSrc);
237
 
                                pdstLine = ilbmScanlineDeltaDst(pdstB, pbox->y1, auxDst);
238
 
                        }
239
 
                        if ((pbox->x1 & PIM) + w <= PPW) {
240
 
                                maskpartialbits (pbox->x1, w, startmask);
241
 
                                endmask = 0;
242
 
                                nlMiddle = 0;
243
 
                        } else {
244
 
                                maskbits(pbox->x1, w, startmask, endmask, nlMiddle);
245
 
                        }
246
 
                        if (xdir == 1) {
247
 
                                xoffSrc = pptSrc->x & PIM;
248
 
                                xoffDst = pbox->x1 & PIM;
249
 
                                pdstLine += (pbox->x1 >> PWSH);
250
 
                                psrcLine += (pptSrc->x >> PWSH);
251
 
#ifdef DO_UNALIGNED_BITBLT
252
 
                                nl = xoffSrc - xoffDst;
253
 
                                psrcLine = (PixelType *)(((unsigned char *) psrcLine) + nl);
254
 
#else
255
 
                                if (xoffSrc == xoffDst)
256
 
#endif
257
 
                                {
258
 
                                        while (h--) {
259
 
                                                psrc = psrcLine;
260
 
                                                pdst = pdstLine;
261
 
                                                if (startmask) {
262
 
                                                        *pdst = MROP_MASK(*psrc, *pdst, startmask);
263
 
                                                        psrc++;
264
 
                                                        pdst++;
265
 
                                                }
266
 
                                                nl = nlMiddle;
267
 
 
268
 
#ifdef LARGE_INSTRUCTION_CACHE
269
 
#ifdef FAST_CONSTANT_OFFSET_MODE
270
 
 
271
 
                                                psrc += nl & (UNROLL-1);
272
 
                                                pdst += nl & (UNROLL-1);
273
 
 
274
 
#define BodyOdd(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
275
 
#define BodyEven(n) pdst[-n] = MROP_SOLID (psrc[-n], pdst[-n]);
276
 
 
277
 
#define LoopReset \
278
 
pdst += UNROLL; \
279
 
psrc += UNROLL;
280
 
 
281
 
#else
282
 
 
283
 
#define BodyOdd(n)  *pdst = MROP_SOLID (*psrc, *pdst); pdst++; psrc++;
284
 
#define BodyEven(n) BodyOdd(n)
285
 
 
286
 
#define LoopReset   ;
287
 
 
288
 
#endif
289
 
                                                PackedLoop
290
 
 
291
 
#undef BodyOdd
292
 
#undef BodyEven
293
 
#undef LoopReset
294
 
 
295
 
#else
296
 
#ifdef NOTDEF
297
 
                                                /* you'd think this would be faster --
298
 
                                                 * a single instruction instead of 6
299
 
                                                 * but measurements show it to be ~15% slower
300
 
                                                 */
301
 
                                                while ((nl -= 6) >= 0) {
302
 
                                                        asm ("moveml %1+,#0x0c0f;moveml#0x0c0f,%0"
303
 
                                                                 : "=m" (*(char *)pdst)
304
 
                                                                 : "m" (*(char *)psrc)
305
 
                                                                 : "d0", "d1", "d2", "d3",
306
 
                                                                   "a2", "a3");
307
 
                                                        pdst += 6;
308
 
                                                }
309
 
                                                nl += 6;
310
 
                                                while (nl--)
311
 
                                                        *pdst++ = *psrc++;
312
 
#endif
313
 
                                                DuffL(nl, label1,
314
 
                                                                *pdst = MROP_SOLID (*psrc, *pdst);
315
 
                                                                pdst++; psrc++;)
316
 
#endif
317
 
 
318
 
                                                if (endmask)
319
 
                                                        *pdst = MROP_MASK(*psrc, *pdst, endmask);
320
 
                                                ilbmScanlineIncDst(pdstLine, auxDst);
321
 
                                                ilbmScanlineIncSrc(psrcLine, auxSrc);
322
 
                                        }
323
 
                                }
324
 
#ifndef DO_UNALIGNED_BITBLT
325
 
                                else {
326
 
                                        if (xoffSrc > xoffDst) {
327
 
                                                leftShift = (xoffSrc - xoffDst);
328
 
                                                rightShift = PPW - leftShift;
329
 
                                        } else {
330
 
                                                rightShift = (xoffDst - xoffSrc);
331
 
                                                leftShift = PPW - rightShift;
332
 
                                        }
333
 
                                        while (h--) {
334
 
                                                psrc = psrcLine;
335
 
                                                pdst = pdstLine;
336
 
                                                bits = 0;
337
 
                                                if (xoffSrc > xoffDst)
338
 
                                                        bits = *psrc++;
339
 
                                                if (startmask) {
340
 
                                                        bits1 = BitLeft(bits,leftShift);
341
 
                                                        bits = *psrc++;
342
 
                                                        bits1 |= BitRight(bits,rightShift);
343
 
                                                        *pdst = MROP_MASK(bits1, *pdst, startmask);
344
 
                                                        pdst++;
345
 
                                                }
346
 
                                                nl = nlMiddle;
347
 
 
348
 
#ifdef LARGE_INSTRUCTION_CACHE
349
 
                                                bits1 = bits;
350
 
 
351
 
#ifdef FAST_CONSTANT_OFFSET_MODE
352
 
 
353
 
                                                psrc += nl & (UNROLL-1);
354
 
                                                pdst += nl & (UNROLL-1);
355
 
 
356
 
#define BodyOdd(n) \
357
 
bits = psrc[-n]; \
358
 
pdst[-n] = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), pdst[-n]);
359
 
 
360
 
#define BodyEven(n) \
361
 
bits1 = psrc[-n]; \
362
 
pdst[-n] = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), pdst[-n]);
363
 
 
364
 
#define LoopReset \
365
 
pdst += UNROLL; \
366
 
psrc += UNROLL;
367
 
 
368
 
#else
369
 
 
370
 
#define BodyOdd(n) \
371
 
bits = *psrc++; \
372
 
*pdst = MROP_SOLID(BitLeft(bits1, leftShift) | BitRight(bits, rightShift), *pdst); \
373
 
pdst++;
374
 
 
375
 
#define BodyEven(n) \
376
 
bits1 = *psrc++; \
377
 
*pdst = MROP_SOLID(BitLeft(bits, leftShift) | BitRight(bits1, rightShift), *pdst); \
378
 
pdst++;
379
 
 
380
 
#define LoopReset   ;
381
 
 
382
 
#endif          /* !FAST_CONSTANT_OFFSET_MODE */
383
 
 
384
 
                                                PackedLoop
385
 
 
386
 
#undef BodyOdd
387
 
#undef BodyEven
388
 
#undef LoopReset
389
 
 
390
 
#else
391
 
                                                DuffL(nl,label2,
392
 
                                                        bits1 = BitLeft(bits, leftShift);
393
 
                                                        bits = *psrc++;
394
 
                                                        *pdst = MROP_SOLID (bits1 | BitRight(bits, rightShift), *pdst);
395
 
                                                        pdst++;
396
 
                                                )
397
 
#endif
398
 
 
399
 
                                                if (endmask) {
400
 
                                                        bits1 = BitLeft(bits, leftShift);
401
 
                                                        if (BitLeft(endmask, rightShift)) {
402
 
                                                                bits = *psrc;
403
 
                                                                        bits1 |= BitRight(bits, rightShift);
404
 
                                                        }
405
 
                                                        *pdst = MROP_MASK (bits1, *pdst, endmask);
406
 
                                                }
407
 
                                                ilbmScanlineIncDst(pdstLine, auxDst);
408
 
                                                ilbmScanlineIncSrc(psrcLine, auxSrc);
409
 
                                        }
410
 
                                }
411
 
#endif /* DO_UNALIGNED_BITBLT */
412
 
                        } else {                /* xdir == -1 */
413
 
                                xoffSrc = (pptSrc->x + w - 1) & PIM;
414
 
                                xoffDst = (pbox->x2 - 1) & PIM;
415
 
                                pdstLine += ((pbox->x2-1) >> PWSH) + 1;
416
 
                                psrcLine += ((pptSrc->x+w - 1) >> PWSH) + 1;
417
 
#ifdef DO_UNALIGNED_BITBLT
418
 
                                nl = xoffSrc - xoffDst;
419
 
                                psrcLine = (PixelType *)
420
 
                                                        (((unsigned char *) psrcLine) + nl);
421
 
#else
422
 
                                if (xoffSrc == xoffDst)
423
 
#endif
424
 
                                {
425
 
                                        while (h--) {
426
 
                                                psrc = psrcLine;
427
 
                                                pdst = pdstLine;
428
 
                                                if (endmask) {
429
 
                                                        pdst--;
430
 
                                                        psrc--;
431
 
                                                        *pdst = MROP_MASK (*psrc, *pdst, endmask);
432
 
                                                }
433
 
                                                nl = nlMiddle;
434
 
 
435
 
#ifdef LARGE_INSTRUCTION_CACHE
436
 
#ifdef FAST_CONSTANT_OFFSET_MODE
437
 
                                                psrc -= nl & (UNROLL - 1);
438
 
                                                pdst -= nl & (UNROLL - 1);
439
 
 
440
 
#define BodyOdd(n) pdst[n-1] = MROP_SOLID (psrc[n-1], pdst[n-1]);
441
 
 
442
 
#define BodyEven(n) BodyOdd(n)
443
 
 
444
 
#define LoopReset \
445
 
pdst -= UNROLL;\
446
 
psrc -= UNROLL;
447
 
 
448
 
#else
449
 
 
450
 
#define BodyOdd(n)  --pdst; --psrc; *pdst = MROP_SOLID(*psrc, *pdst);
451
 
#define BodyEven(n) BodyOdd(n)
452
 
#define LoopReset   ;
453
 
 
454
 
#endif
455
 
                                                PackedLoop
456
 
 
457
 
#undef BodyOdd
458
 
#undef BodyEven
459
 
#undef LoopReset
460
 
 
461
 
#else
462
 
                                                DuffL(nl,label3,
463
 
                                                         --pdst; --psrc; *pdst = MROP_SOLID (*psrc, *pdst);)
464
 
#endif
465
 
 
466
 
                                                if (startmask) {
467
 
                                                        --pdst;
468
 
                                                        --psrc;
469
 
                                                        *pdst = MROP_MASK(*psrc, *pdst, startmask);
470
 
                                                }
471
 
                                                ilbmScanlineIncDst(pdstLine, auxDst);
472
 
                                                ilbmScanlineIncSrc(psrcLine, auxSrc);
473
 
                                        }
474
 
                                }
475
 
#ifndef DO_UNALIGNED_BITBLT
476
 
                                else {
477
 
                                        if (xoffDst > xoffSrc) {
478
 
                                                rightShift = (xoffDst - xoffSrc);
479
 
                                                leftShift = PPW - rightShift;
480
 
                                        } else {
481
 
                                                leftShift = (xoffSrc - xoffDst);
482
 
                                                rightShift = PPW - leftShift;
483
 
                                        }
484
 
                                        while (h--) {
485
 
                                                psrc = psrcLine;
486
 
                                                pdst = pdstLine;
487
 
                                                bits = 0;
488
 
                                                if (xoffDst > xoffSrc)
489
 
                                                        bits = *--psrc;
490
 
                                                if (endmask) {
491
 
                                                        bits1 = BitRight(bits, rightShift);
492
 
                                                        bits = *--psrc;
493
 
                                                        bits1 |= BitLeft(bits, leftShift);
494
 
                                                        pdst--;
495
 
                                                        *pdst = MROP_MASK(bits1, *pdst, endmask);
496
 
                                                }
497
 
                                                nl = nlMiddle;
498
 
 
499
 
#ifdef LARGE_INSTRUCTION_CACHE
500
 
                                                bits1 = bits;
501
 
#ifdef FAST_CONSTANT_OFFSET_MODE
502
 
                                                psrc -= nl & (UNROLL - 1);
503
 
                                                pdst -= nl & (UNROLL - 1);
504
 
 
505
 
#define BodyOdd(n) \
506
 
bits = psrc[n-1]; \
507
 
pdst[n-1] = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),pdst[n-1]);
508
 
 
509
 
#define BodyEven(n) \
510
 
bits1 = psrc[n-1]; \
511
 
pdst[n-1] = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),pdst[n-1]);
512
 
 
513
 
#define LoopReset \
514
 
pdst -= UNROLL; \
515
 
psrc -= UNROLL;
516
 
 
517
 
#else
518
 
 
519
 
#define BodyOdd(n) \
520
 
bits = *--psrc; --pdst; \
521
 
*pdst = MROP_SOLID(BitRight(bits1, rightShift) | BitLeft(bits, leftShift),*pdst);
522
 
 
523
 
#define BodyEven(n) \
524
 
bits1 = *--psrc; --pdst; \
525
 
*pdst = MROP_SOLID(BitRight(bits, rightShift) | BitLeft(bits1, leftShift),*pdst);
526
 
 
527
 
#define LoopReset   ;
528
 
 
529
 
#endif
530
 
 
531
 
                                                PackedLoop
532
 
 
533
 
#undef BodyOdd
534
 
#undef BodyEven
535
 
#undef LoopReset
536
 
 
537
 
#else
538
 
                                                DuffL(nl, label4,
539
 
                                                        bits1 = BitRight(bits, rightShift);
540
 
                                                        bits = *--psrc;
541
 
                                                        --pdst;
542
 
                                                        *pdst = MROP_SOLID(bits1 | BitLeft(bits, leftShift),*pdst);
543
 
                                                )
544
 
#endif
545
 
 
546
 
                                                if (startmask) {
547
 
                                                        bits1 = BitRight(bits, rightShift);
548
 
                                                        if (BitRight (startmask, leftShift)) {
549
 
                                                                bits = *--psrc;
550
 
                                                                bits1 |= BitLeft(bits, leftShift);
551
 
                                                        }
552
 
                                                        --pdst;
553
 
                                                        *pdst = MROP_MASK(bits1, *pdst, startmask);
554
 
                                                }
555
 
                                                ilbmScanlineIncDst(pdstLine, auxDst);
556
 
                                                ilbmScanlineIncSrc(psrcLine, auxSrc);
557
 
                                        }
558
 
                                }
559
 
#endif
560
 
                        }
561
 
                }
562
 
                pbox++;
563
 
                pptSrc++;
564
 
        }
565
 
        if (pboxNew2) {
566
 
                DEALLOCATE_LOCAL(pptNew2);
567
 
                DEALLOCATE_LOCAL(pboxNew2);
568
 
        }
569
 
        if (pboxNew1) {
570
 
                DEALLOCATE_LOCAL(pptNew1);
571
 
                DEALLOCATE_LOCAL(pboxNew1);
572
 
        }
573
 
}