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

« back to all changes in this revision

Viewing changes to miext/rootless/accel/rlCopy.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
/*
 
2
 * This code is largely copied from fbcopy.c.
 
3
 *
 
4
 * Copyright © 1998 Keith Packard
 
5
 * Copyright (c) 2003 Torrey T. Lyons. All Rights Reserved.
 
6
 *
 
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.
 
16
 *
 
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.
 
24
 */
 
25
/* $XFree86: xc/programs/Xserver/fb/fbcopy.c,v 1.12 2001/07/16 05:04:05 keithp Exp $ */
 
26
 
 
27
#ifdef HAVE_DIX_CONFIG_H
 
28
#include <dix-config.h>
 
29
#endif
 
30
 
 
31
#include "fb.h"
 
32
#include "rlAccel.h"
 
33
 
 
34
 
 
35
void
 
36
rlCopyNtoN (DrawablePtr pSrcDrawable,
 
37
            DrawablePtr pDstDrawable,
 
38
            GCPtr       pGC,
 
39
            BoxPtr      pbox,
 
40
            int         nbox,
 
41
            int         dx,
 
42
            int         dy,
 
43
            Bool        reverse,
 
44
            Bool        upsidedown,
 
45
            Pixel       bitplane,
 
46
            void        *closure)
 
47
{
 
48
    CARD8       alu = pGC ? pGC->alu : GXcopy;
 
49
    FbBits      pm = pGC ? fbGetGCPrivate(pGC)->pm : FB_ALLONES;
 
50
    FbBits      *src;
 
51
    FbStride    srcStride;
 
52
    int         srcBpp;
 
53
    int         srcXoff, srcYoff;
 
54
    FbBits      *dst;
 
55
    FbStride    dstStride;
 
56
    int         dstBpp;
 
57
    int         dstXoff, dstYoff;
 
58
    
 
59
    fbGetDrawable (pSrcDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
 
60
    fbGetDrawable (pDstDrawable, dst, dstStride, dstBpp, dstXoff, dstYoff);
 
61
    
 
62
    while (nbox--)
 
63
    {
 
64
        rlBlt (src + (pbox->y1 + dy + srcYoff) * srcStride,
 
65
               srcStride,
 
66
               (pbox->x1 + dx + srcXoff) * srcBpp,
 
67
    
 
68
               pDstDrawable->pScreen,
 
69
               dst + (pbox->y1 + dstYoff) * dstStride,
 
70
               dstStride,
 
71
               (pbox->x1 + dstXoff) * dstBpp,
 
72
    
 
73
               (pbox->x2 - pbox->x1) * dstBpp,
 
74
               (pbox->y2 - pbox->y1),
 
75
    
 
76
               alu,
 
77
               pm,
 
78
               dstBpp,
 
79
    
 
80
               reverse,
 
81
               upsidedown);
 
82
        pbox++;
 
83
    }
 
84
}
 
85
 
 
86
RegionPtr
 
87
rlCopyArea (DrawablePtr pSrcDrawable,
 
88
            DrawablePtr pDstDrawable,
 
89
            GCPtr       pGC,
 
90
            int         xIn, 
 
91
            int         yIn,
 
92
            int         widthSrc, 
 
93
            int         heightSrc,
 
94
            int         xOut, 
 
95
            int         yOut)
 
96
{
 
97
    fbCopyProc  copy;
 
98
    
 
99
#ifdef FB_24_32BIT
 
100
    if (pSrcDrawable->bitsPerPixel != pDstDrawable->bitsPerPixel)
 
101
        copy = fb24_32CopyMtoN;
 
102
    else
 
103
#endif
 
104
        copy = rlCopyNtoN;
 
105
    return fbDoCopy (pSrcDrawable, pDstDrawable, pGC, xIn, yIn,
 
106
                     widthSrc, heightSrc, xOut, yOut, copy, 0, 0);
 
107
}