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

« back to all changes in this revision

Viewing changes to iplan2p4/iplpolypnt.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: xc/programs/Xserver/iplan2p4/iplpolypnt.c,v 3.0 1996/08/18 01:55:02 dawes Exp $ */
 
2
/************************************************************
 
3
 
 
4
Copyright (c) 1989  X Consortium
 
5
 
 
6
Permission is hereby granted, free of charge, to any person obtaining a copy
 
7
of this software and associated documentation files (the "Software"), to deal
 
8
in the Software without restriction, including without limitation the rights
 
9
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 
10
copies of the Software, and to permit persons to whom the Software is
 
11
furnished to do so, subject to the following conditions:
 
12
 
 
13
The above copyright notice and this permission notice shall be included in
 
14
all copies or substantial portions of the Software.
 
15
 
 
16
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
17
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
18
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 
19
X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 
20
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 
21
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
22
 
 
23
Except as contained in this notice, the name of the X Consortium shall not be
 
24
used in advertising or otherwise to promote the sale, use or other dealings
 
25
in this Software without prior written authorization from the X Consortium.
 
26
 
 
27
********************************************************/
 
28
 
 
29
/* $XConsortium: iplpolypnt.c,v 5.17 94/04/17 20:28:57 dpw Exp $ */
 
30
 
 
31
/* Modified nov 94 by Martin Schaller (Martin_Schaller@maus.r.de) for use with
 
32
interleaved planes */
 
33
 
 
34
#ifdef HAVE_DIX_CONFIG_H
 
35
#include <dix-config.h>
 
36
#endif
 
37
 
 
38
#include <X11/X.h>
 
39
#include "gcstruct.h"
 
40
#include "windowstr.h"
 
41
#include "pixmapstr.h"
 
42
#include "regionstr.h"
 
43
#include "scrnintstr.h"
 
44
#include "ipl.h"
 
45
#include "iplmskbits.h"
 
46
 
 
47
#define isClipped(c,ul,lr)  ((((c) - (ul)) | ((lr) - (c))) & ClipMask)
 
48
 
 
49
/* WARNING: pbox contains two shorts. This code assumes they are packed
 
50
 * and can be referenced together as an INT32.
 
51
 */
 
52
 
 
53
#define PointLoop(fill) { \
 
54
    for (nbox = REGION_NUM_RECTS(cclip), pbox = REGION_RECTS(cclip); \
 
55
         --nbox >= 0; \
 
56
         pbox++) \
 
57
    { \
 
58
        c1 = *((INT32 *) &pbox->x1) - off; \
 
59
        c2 = *((INT32 *) &pbox->x2) - off - 0x00010001; \
 
60
        for (ppt = (INT32 *) pptInit, i = npt; --i >= 0;) \
 
61
        { \
 
62
            pt = *ppt++; \
 
63
            if (!isClipped(pt,c1,c2)) { \
 
64
                fill \
 
65
            } \
 
66
        } \
 
67
    } \
 
68
}
 
69
 
 
70
void
 
71
iplPolyPoint(pDrawable, pGC, mode, npt, pptInit)
 
72
    DrawablePtr pDrawable;
 
73
    GCPtr pGC;
 
74
    int mode;
 
75
    int npt;
 
76
    xPoint *pptInit;
 
77
{
 
78
    register INT32   pt;
 
79
    register INT32   c1, c2;
 
80
    register unsigned long   ClipMask = 0x80008000;
 
81
    INTER_DECLAREG(*addrg);
 
82
    register int    ngwidth;
 
83
    register int    xoffset;
 
84
    INTER_DECLAREG(*addrgt);
 
85
    register INT32  *ppt;
 
86
    RegionPtr       cclip;
 
87
    int             nbox;
 
88
    register int    i;
 
89
    register BoxPtr pbox;
 
90
    INTER_DECLARERRAX(and);
 
91
    INTER_DECLARERRAX(xor);
 
92
    int             rop = pGC->alu;
 
93
    int             off;
 
94
    iplPrivGCPtr    devPriv;
 
95
    xPoint          *pptPrev;
 
96
 
 
97
    devPriv =iplGetGCPrivate(pGC);
 
98
    rop = devPriv->rop;
 
99
    if (rop == GXnoop)
 
100
        return;
 
101
    cclip = pGC->pCompositeClip;
 
102
    xor = devPriv->xorg;
 
103
    and = devPriv->andg;
 
104
    if ((mode == CoordModePrevious) && (npt > 1))
 
105
    {
 
106
        for (pptPrev = pptInit + 1, i = npt - 1; --i >= 0; pptPrev++)
 
107
        {
 
108
            pptPrev->x += (pptPrev-1)->x;
 
109
            pptPrev->y += (pptPrev-1)->y;
 
110
        }
 
111
    }
 
112
    off = *((int *) &pDrawable->x);
 
113
    off -= (off & 0x8000) << 1;
 
114
    iplGetGroupWidthAndPointer(pDrawable, ngwidth, addrg);
 
115
    addrg = addrg + pDrawable->y * ngwidth + 
 
116
                (pDrawable->x >> INTER_PGSH) * INTER_PLANES;
 
117
    xoffset = pDrawable->x & INTER_PIM;
 
118
    PointLoop(   addrgt = addrg + intToY(pt) * ngwidth
 
119
                       + ((intToX(pt) + xoffset) >> INTER_PGSH) * INTER_PLANES;
 
120
                   INTER_DoMaskRRop(addrgt, and, xor, 
 
121
                        iplmask[(intToX(pt) + xoffset) & INTER_PIM], addrgt);
 
122
             )
 
123
}