1
/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/ppcClip.c,v 1.4 1999/06/06 08:48:58 dawes Exp $ */
4
Copyright (c) 1987 X Consortium
6
Permission is hereby granted, free of charge, to any person obtaining
7
a copy of this software and associated documentation files (the
8
"Software"), to deal in the Software without restriction, including
9
without limitation the rights to use, copy, modify, merge, publish,
10
distribute, sublicense, and/or sell copies of the Software, and to
11
permit persons to whom the Software is furnished to do so, subject to
12
the following conditions:
14
The above copyright notice and this permission notice shall be included
15
in all copies or substantial portions of the Software.
17
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20
IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR
21
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
OTHER DEALINGS IN THE SOFTWARE.
25
Except as contained in this notice, the name of the X Consortium shall
26
not be used in advertising or otherwise to promote the sale, use or
27
other dealings in this Software without prior written authorization
28
from the X Consortium.
31
Copyright IBM Corporation 1987,1988,1989
34
Permission to use, copy, modify, and distribute this software and its
35
documentation for any purpose and without fee is hereby granted,
36
provided that the above copyright notice appear in all copies and that
37
both that copyright notice and this permission notice appear in
38
supporting documentation, and that the name of IBM not be
39
used in advertising or publicity pertaining to distribution of the
40
software without specific, written prior permission.
42
IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
43
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
44
IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
45
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
46
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
47
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
51
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts,
54
Permission to use, copy, modify, and distribute this software and its
55
documentation for any purpose and without fee is hereby granted,
56
provided that the above copyright notice appear in all copies and that
57
both that copyright notice and this permission notice appear in
58
supporting documentation, and that the name of Digital not be
59
used in advertising or publicity pertaining to distribution of the
60
software without specific, written prior permission.
62
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
63
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
64
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
65
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
66
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
67
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
71
/* $XConsortium: ppcClip.c /main/4 1996/02/21 17:57:21 kaleb $ */
73
#ifdef HAVE_XORG_CONFIG_H
74
#include <xorg-config.h>
80
#include "scrnintstr.h"
83
xf4bppDestroyClip(pGC)
86
if(pGC->clientClipType == CT_NONE)
88
else if (pGC->clientClipType == CT_PIXMAP)
90
mfbDestroyPixmap((PixmapPtr)(pGC->clientClip));
94
/* we know we'll never have a list of rectangles, since
95
ChangeClip immediately turns them into a region
97
REGION_DESTROY(pGC->pScreen, pGC->clientClip);
99
pGC->clientClip = NULL;
100
pGC->clientClipType = CT_NONE;
104
xf4bppChangeClip(pGC, type, pvalue, nrects)
110
xf4bppDestroyClip(pGC);
111
if(type == CT_PIXMAP)
113
/* convert the pixmap to a region */
114
pGC->clientClip = (pointer) (*pGC->pScreen->BitmapToRegion)((PixmapPtr)pvalue);
115
/* you wouldn't do this if you were leaving the pixmap in
116
rather than converting it.
118
(*pGC->pScreen->DestroyPixmap)(pvalue);
120
else if (type == CT_REGION)
122
/* stuff the region in the GC */
123
pGC->clientClip = pvalue;
125
else if (type != CT_NONE)
127
pGC->clientClip = (pointer) RECTS_TO_REGION(pGC->pScreen, nrects,
128
(xRectangle *)pvalue,
132
pGC->clientClipType = (type != CT_NONE && pGC->clientClip) ? CT_REGION :
134
pGC->stateChanges |= GCClipMask;
138
xf4bppCopyClip (pgcDst, pgcSrc)
139
GCPtr pgcDst, pgcSrc;
143
switch(pgcSrc->clientClipType)
146
((PixmapPtr) pgcSrc->clientClip)->refcnt++;
147
/* Fall through !! */
149
xf4bppChangeClip(pgcDst, pgcSrc->clientClipType, pgcSrc->clientClip, 0);
152
prgnNew = REGION_CREATE(pgcSrc->pScreen, NULL, 1);
153
REGION_COPY(pgcSrc->pScreen, prgnNew, (RegionPtr)(pgcSrc->clientClip));
154
xf4bppChangeClip(pgcDst, CT_REGION, (pointer)prgnNew, 0);