1
/* $Xorg: CopyGC.c,v 1.4 2001/02/09 02:03:32 xorgcvs Exp $ */
4
Copyright 1986, 1998 The Open Group
6
Permission to use, copy, modify, distribute, and sell this software and its
7
documentation for any purpose is hereby granted without fee, provided that
8
the above copyright notice appear in all copies and that both that
9
copyright notice and this permission notice appear in supporting
12
The above copyright notice and this permission notice shall be included in
13
all copies or substantial portions of the Software.
15
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
19
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
22
Except as contained in this notice, the name of The Open Group shall not be
23
used in advertising or otherwise to promote the sale, use or other dealings
24
in this Software without prior written authorization from The Open Group.
27
/* $XFree86: xc/lib/X11/CopyGC.c,v 1.4 2001/12/14 19:53:59 dawes Exp $ */
32
XCopyGC (dpy, srcGC, mask, destGC)
33
register Display *dpy;
34
unsigned long mask; /* which ones to set initially */
37
register XGCValues *destgv = &destGC->values,
38
*srcgv = &srcGC->values;
39
register xCopyGCReq *req;
40
register _XExtension *ext;
44
mask &= (1L << (GCLastBit + 1)) - 1;
45
/* if some of the source values to be copied are "dirty", flush them
46
out before sending the CopyGC request. */
47
if (srcGC->dirty & mask)
48
_XFlushGCCache(dpy, srcGC);
50
/* mark the copied values "not dirty" in the destination. */
51
destGC->dirty &= ~mask;
54
req->srcGC = srcGC->gid;
55
req->dstGC = destGC->gid;
58
if (mask & GCFunction)
59
destgv->function = srcgv->function;
61
if (mask & GCPlaneMask)
62
destgv->plane_mask = srcgv->plane_mask;
64
if (mask & GCForeground)
65
destgv->foreground = srcgv->foreground;
67
if (mask & GCBackground)
68
destgv->background = srcgv->background;
70
if (mask & GCLineWidth)
71
destgv->line_width = srcgv->line_width;
73
if (mask & GCLineStyle)
74
destgv->line_style = srcgv->line_style;
76
if (mask & GCCapStyle)
77
destgv->cap_style = srcgv->cap_style;
79
if (mask & GCJoinStyle)
80
destgv->join_style = srcgv->join_style;
82
if (mask & GCFillStyle)
83
destgv->fill_style = srcgv->fill_style;
85
if (mask & GCFillRule)
86
destgv->fill_rule = srcgv->fill_rule;
89
destgv->arc_mode = srcgv->arc_mode;
92
destgv->tile = srcgv->tile;
95
destgv->stipple = srcgv->stipple;
97
if (mask & GCTileStipXOrigin)
98
destgv->ts_x_origin = srcgv->ts_x_origin;
100
if (mask & GCTileStipYOrigin)
101
destgv->ts_y_origin = srcgv->ts_y_origin;
104
destgv->font = srcgv->font;
106
if (mask & GCSubwindowMode)
107
destgv->subwindow_mode = srcgv->subwindow_mode;
109
if (mask & GCGraphicsExposures)
110
destgv->graphics_exposures = srcgv->graphics_exposures;
112
if (mask & GCClipXOrigin)
113
destgv->clip_x_origin = srcgv->clip_x_origin;
115
if (mask & GCClipYOrigin)
116
destgv->clip_y_origin = srcgv->clip_y_origin;
118
if (mask & GCClipMask) {
119
destGC->rects = srcGC->rects;
120
destgv->clip_mask = srcgv->clip_mask;
123
if (mask & GCDashOffset)
124
destgv->dash_offset = srcgv->dash_offset;
126
if (mask & GCDashList) {
127
destGC->dashes = srcGC->dashes;
128
destgv->dashes = srcgv->dashes;
130
/* call out to any extensions interested */
131
for (ext = dpy->ext_procs; ext; ext = ext->next)
132
if (ext->copy_GC) (*ext->copy_GC)(dpy, destGC, &ext->codes);