First import
[xorg_rtime.git] / xorg-server-1.4 / miext / rootless / accel / rlCopy.c
blobdf6fc11a7b488fb0e490868e0622e0eb0d5cab79
1 /*
2 * This code is largely copied from fbcopy.c.
4 * Copyright © 1998 Keith Packard
5 * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
7 * Permission to use, copy, modify, distribute, and sell this software and its
8 * documentation for any purpose is hereby granted without fee, provided that
9 * the above copyright notice appear in all copies and that both that
10 * copyright notice and this permission notice appear in supporting
11 * documentation, and that the name of Keith Packard not be used in
12 * advertising or publicity pertaining to distribution of the software without
13 * specific, written prior permission. Keith Packard makes no
14 * representations about the suitability of this software for any purpose. It
15 * is provided "as is" without express or implied warranty.
17 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
19 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
20 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
21 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
22 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
23 * PERFORMANCE OF THIS SOFTWARE.
26 #ifdef HAVE_DIX_CONFIG_H
27 #include <dix-config.h>
28 #endif
30 #include "fb.h"
31 #include "rlAccel.h"
34 void
35 rlCopyNtoN (DrawablePtr pSrcDrawable,
36 DrawablePtr pDstDrawable,
37 GCPtr pGC,
38 BoxPtr pbox,
39 int nbox,
40 int dx,
41 int dy,
42 Bool reverse,
43 Bool upsidedown,
44 Pixel bitplane,
45 void *closure)
47 CARD8 alu = pGC ? pGC->alu : GXcopy;
48 FbBits pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES;
49 FbBits *src;
50 FbStride srcStride;
51 int srcBpp;
52 int srcXoff, srcYoff;
53 FbBits *dst;
54 FbStride dstStride;
55 int dstBpp;
56 int dstXoff, dstYoff;
58 fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
59 fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
61 while (nbox--)
63 rlBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
64 srcStride,
65 (pbox->x1 + dx + srcXoff) * srcBpp,
67 pDstDrawable->pScreen,
68 dst + (pbox->y1 + dstYoff) * dstStride,
69 dstStride,
70 (pbox->x1 + dstXoff) * dstBpp,
72 (pbox->x2 - pbox->x1) * dstBpp,
73 (pbox->y2 - pbox->y1),
75 alu,
76 pm,
77 dstBpp,
79 reverse,
80 upsidedown);
81 pbox++;
85 RegionPtr
86 rlCopyArea (DrawablePtr pSrcDrawable,
87 DrawablePtr pDstDrawable,
88 GCPtr pGC,
89 int xIn,
90 int yIn,
91 int widthSrc,
92 int heightSrc,
93 int xOut,
94 int yOut)
96 fbCopyProc copy;
98 #ifdef FB_24_32BIT
99 if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
100 copy = fb24_32CopyMtoN;
101 else
102 #endif
103 copy = rlCopyNtoN;
104 return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
105 widthSrc, heightSrc, xOut, yOut, copy, 0, 0);