gcstruct.h revision 6747b715
105b261ecSmrg/***********************************************************
205b261ecSmrg
305b261ecSmrgCopyright 1987, 1998  The Open Group
405b261ecSmrg
505b261ecSmrgPermission to use, copy, modify, distribute, and sell this software and its
605b261ecSmrgdocumentation for any purpose is hereby granted without fee, provided that
705b261ecSmrgthe above copyright notice appear in all copies and that both that
805b261ecSmrgcopyright notice and this permission notice appear in supporting
905b261ecSmrgdocumentation.
1005b261ecSmrg
1105b261ecSmrgThe above copyright notice and this permission notice shall be included in
1205b261ecSmrgall copies or substantial portions of the Software.
1305b261ecSmrg
1405b261ecSmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1505b261ecSmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1605b261ecSmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
1705b261ecSmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
1805b261ecSmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
1905b261ecSmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2005b261ecSmrg
2105b261ecSmrgExcept as contained in this notice, the name of The Open Group shall not be
2205b261ecSmrgused in advertising or otherwise to promote the sale, use or other dealings
2305b261ecSmrgin this Software without prior written authorization from The Open Group.
2405b261ecSmrg
2505b261ecSmrg
2605b261ecSmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
2705b261ecSmrg
2805b261ecSmrg                        All Rights Reserved
2905b261ecSmrg
3005b261ecSmrgPermission to use, copy, modify, and distribute this software and its
3105b261ecSmrgdocumentation for any purpose and without fee is hereby granted,
3205b261ecSmrgprovided that the above copyright notice appear in all copies and that
3305b261ecSmrgboth that copyright notice and this permission notice appear in
3405b261ecSmrgsupporting documentation, and that the name of Digital not be
3505b261ecSmrgused in advertising or publicity pertaining to distribution of the
3605b261ecSmrgsoftware without specific, written prior permission.
3705b261ecSmrg
3805b261ecSmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
3905b261ecSmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
4005b261ecSmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
4105b261ecSmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
4205b261ecSmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
4305b261ecSmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
4405b261ecSmrgSOFTWARE.
4505b261ecSmrg
4605b261ecSmrg******************************************************************/
4705b261ecSmrg
4805b261ecSmrg
4905b261ecSmrg
5005b261ecSmrg#ifndef GCSTRUCT_H
5105b261ecSmrg#define GCSTRUCT_H
5205b261ecSmrg
5305b261ecSmrg#include "gc.h"
5405b261ecSmrg
5505b261ecSmrg#include "regionstr.h"
5605b261ecSmrg#include "region.h"
5705b261ecSmrg#include "pixmap.h"
5805b261ecSmrg#include "screenint.h"
594642e01fSmrg#include "privates.h"
6005b261ecSmrg#include <X11/Xprotostr.h>
6105b261ecSmrg
626747b715Smrg#define GCAllBits ((1 << (GCLastBit + 1)) - 1)
636747b715Smrg
6405b261ecSmrg/*
6505b261ecSmrg * functions which modify the state of the GC
6605b261ecSmrg */
6705b261ecSmrg
6805b261ecSmrgtypedef struct _GCFuncs {
6905b261ecSmrg    void	(* ValidateGC)(
7005b261ecSmrg		GCPtr /*pGC*/,
7105b261ecSmrg		unsigned long /*stateChanges*/,
7205b261ecSmrg		DrawablePtr /*pDrawable*/);
7305b261ecSmrg
7405b261ecSmrg    void	(* ChangeGC)(
7505b261ecSmrg		GCPtr /*pGC*/,
7605b261ecSmrg		unsigned long /*mask*/);
7705b261ecSmrg
7805b261ecSmrg    void	(* CopyGC)(
7905b261ecSmrg		GCPtr /*pGCSrc*/,
8005b261ecSmrg		unsigned long /*mask*/,
8105b261ecSmrg		GCPtr /*pGCDst*/);
8205b261ecSmrg
8305b261ecSmrg    void	(* DestroyGC)(
8405b261ecSmrg		GCPtr /*pGC*/);
8505b261ecSmrg
8605b261ecSmrg    void	(* ChangeClip)(
8705b261ecSmrg		GCPtr /*pGC*/,
8805b261ecSmrg		int /*type*/,
8905b261ecSmrg		pointer /*pvalue*/,
9005b261ecSmrg		int /*nrects*/);
9105b261ecSmrg
9205b261ecSmrg    void	(* DestroyClip)(
9305b261ecSmrg		GCPtr /*pGC*/);
9405b261ecSmrg
9505b261ecSmrg    void	(* CopyClip)(
9605b261ecSmrg		GCPtr /*pgcDst*/,
9705b261ecSmrg		GCPtr /*pgcSrc*/);
9805b261ecSmrg    DevUnion	devPrivate;
9905b261ecSmrg} GCFuncs;
10005b261ecSmrg
10105b261ecSmrg/*
10205b261ecSmrg * graphics operations invoked through a GC
10305b261ecSmrg */
10405b261ecSmrg
10505b261ecSmrgtypedef struct _GCOps {
10605b261ecSmrg    void	(* FillSpans)(
10705b261ecSmrg		DrawablePtr /*pDrawable*/,
10805b261ecSmrg		GCPtr /*pGC*/,
10905b261ecSmrg		int /*nInit*/,
11005b261ecSmrg		DDXPointPtr /*pptInit*/,
11105b261ecSmrg		int * /*pwidthInit*/,
11205b261ecSmrg		int /*fSorted*/);
11305b261ecSmrg
11405b261ecSmrg    void	(* SetSpans)(
11505b261ecSmrg		DrawablePtr /*pDrawable*/,
11605b261ecSmrg		GCPtr /*pGC*/,
11705b261ecSmrg		char * /*psrc*/,
11805b261ecSmrg		DDXPointPtr /*ppt*/,
11905b261ecSmrg		int * /*pwidth*/,
12005b261ecSmrg		int /*nspans*/,
12105b261ecSmrg		int /*fSorted*/);
12205b261ecSmrg
12305b261ecSmrg    void	(* PutImage)(
12405b261ecSmrg		DrawablePtr /*pDrawable*/,
12505b261ecSmrg		GCPtr /*pGC*/,
12605b261ecSmrg		int /*depth*/,
12705b261ecSmrg		int /*x*/,
12805b261ecSmrg		int /*y*/,
12905b261ecSmrg		int /*w*/,
13005b261ecSmrg		int /*h*/,
13105b261ecSmrg		int /*leftPad*/,
13205b261ecSmrg		int /*format*/,
13305b261ecSmrg		char * /*pBits*/);
13405b261ecSmrg
13505b261ecSmrg    RegionPtr	(* CopyArea)(
13605b261ecSmrg		DrawablePtr /*pSrc*/,
13705b261ecSmrg		DrawablePtr /*pDst*/,
13805b261ecSmrg		GCPtr /*pGC*/,
13905b261ecSmrg		int /*srcx*/,
14005b261ecSmrg		int /*srcy*/,
14105b261ecSmrg		int /*w*/,
14205b261ecSmrg		int /*h*/,
14305b261ecSmrg		int /*dstx*/,
14405b261ecSmrg		int /*dsty*/);
14505b261ecSmrg
14605b261ecSmrg    RegionPtr	(* CopyPlane)(
14705b261ecSmrg		DrawablePtr /*pSrcDrawable*/,
14805b261ecSmrg		DrawablePtr /*pDstDrawable*/,
14905b261ecSmrg		GCPtr /*pGC*/,
15005b261ecSmrg		int /*srcx*/,
15105b261ecSmrg		int /*srcy*/,
15205b261ecSmrg		int /*width*/,
15305b261ecSmrg		int /*height*/,
15405b261ecSmrg		int /*dstx*/,
15505b261ecSmrg		int /*dsty*/,
15605b261ecSmrg		unsigned long /*bitPlane*/);
15705b261ecSmrg    void	(* PolyPoint)(
15805b261ecSmrg		DrawablePtr /*pDrawable*/,
15905b261ecSmrg		GCPtr /*pGC*/,
16005b261ecSmrg		int /*mode*/,
16105b261ecSmrg		int /*npt*/,
16205b261ecSmrg		DDXPointPtr /*pptInit*/);
16305b261ecSmrg
16405b261ecSmrg    void	(* Polylines)(
16505b261ecSmrg		DrawablePtr /*pDrawable*/,
16605b261ecSmrg		GCPtr /*pGC*/,
16705b261ecSmrg		int /*mode*/,
16805b261ecSmrg		int /*npt*/,
16905b261ecSmrg		DDXPointPtr /*pptInit*/);
17005b261ecSmrg
17105b261ecSmrg    void	(* PolySegment)(
17205b261ecSmrg		DrawablePtr /*pDrawable*/,
17305b261ecSmrg		GCPtr /*pGC*/,
17405b261ecSmrg		int /*nseg*/,
17505b261ecSmrg		xSegment * /*pSegs*/);
17605b261ecSmrg
17705b261ecSmrg    void	(* PolyRectangle)(
17805b261ecSmrg		DrawablePtr /*pDrawable*/,
17905b261ecSmrg		GCPtr /*pGC*/,
18005b261ecSmrg		int /*nrects*/,
18105b261ecSmrg		xRectangle * /*pRects*/);
18205b261ecSmrg
18305b261ecSmrg    void	(* PolyArc)(
18405b261ecSmrg		DrawablePtr /*pDrawable*/,
18505b261ecSmrg		GCPtr /*pGC*/,
18605b261ecSmrg		int /*narcs*/,
18705b261ecSmrg		xArc * /*parcs*/);
18805b261ecSmrg
18905b261ecSmrg    void	(* FillPolygon)(
19005b261ecSmrg		DrawablePtr /*pDrawable*/,
19105b261ecSmrg		GCPtr /*pGC*/,
19205b261ecSmrg		int /*shape*/,
19305b261ecSmrg		int /*mode*/,
19405b261ecSmrg		int /*count*/,
19505b261ecSmrg		DDXPointPtr /*pPts*/);
19605b261ecSmrg
19705b261ecSmrg    void	(* PolyFillRect)(
19805b261ecSmrg		DrawablePtr /*pDrawable*/,
19905b261ecSmrg		GCPtr /*pGC*/,
20005b261ecSmrg		int /*nrectFill*/,
20105b261ecSmrg		xRectangle * /*prectInit*/);
20205b261ecSmrg
20305b261ecSmrg    void	(* PolyFillArc)(
20405b261ecSmrg		DrawablePtr /*pDrawable*/,
20505b261ecSmrg		GCPtr /*pGC*/,
20605b261ecSmrg		int /*narcs*/,
20705b261ecSmrg		xArc * /*parcs*/);
20805b261ecSmrg
20905b261ecSmrg    int		(* PolyText8)(
21005b261ecSmrg		DrawablePtr /*pDrawable*/,
21105b261ecSmrg		GCPtr /*pGC*/,
21205b261ecSmrg		int /*x*/,
21305b261ecSmrg		int /*y*/,
21405b261ecSmrg		int /*count*/,
21505b261ecSmrg		char * /*chars*/);
21605b261ecSmrg
21705b261ecSmrg    int		(* PolyText16)(
21805b261ecSmrg		DrawablePtr /*pDrawable*/,
21905b261ecSmrg		GCPtr /*pGC*/,
22005b261ecSmrg		int /*x*/,
22105b261ecSmrg		int /*y*/,
22205b261ecSmrg		int /*count*/,
22305b261ecSmrg		unsigned short * /*chars*/);
22405b261ecSmrg
22505b261ecSmrg    void	(* ImageText8)(
22605b261ecSmrg		DrawablePtr /*pDrawable*/,
22705b261ecSmrg		GCPtr /*pGC*/,
22805b261ecSmrg		int /*x*/,
22905b261ecSmrg		int /*y*/,
23005b261ecSmrg		int /*count*/,
23105b261ecSmrg		char * /*chars*/);
23205b261ecSmrg
23305b261ecSmrg    void	(* ImageText16)(
23405b261ecSmrg		DrawablePtr /*pDrawable*/,
23505b261ecSmrg		GCPtr /*pGC*/,
23605b261ecSmrg		int /*x*/,
23705b261ecSmrg		int /*y*/,
23805b261ecSmrg		int /*count*/,
23905b261ecSmrg		unsigned short * /*chars*/);
24005b261ecSmrg
24105b261ecSmrg    void	(* ImageGlyphBlt)(
24205b261ecSmrg		DrawablePtr /*pDrawable*/,
24305b261ecSmrg		GCPtr /*pGC*/,
24405b261ecSmrg		int /*x*/,
24505b261ecSmrg		int /*y*/,
24605b261ecSmrg		unsigned int /*nglyph*/,
24705b261ecSmrg		CharInfoPtr * /*ppci*/,
24805b261ecSmrg		pointer /*pglyphBase*/);
24905b261ecSmrg
25005b261ecSmrg    void	(* PolyGlyphBlt)(
25105b261ecSmrg		DrawablePtr /*pDrawable*/,
25205b261ecSmrg		GCPtr /*pGC*/,
25305b261ecSmrg		int /*x*/,
25405b261ecSmrg		int /*y*/,
25505b261ecSmrg		unsigned int /*nglyph*/,
25605b261ecSmrg		CharInfoPtr * /*ppci*/,
25705b261ecSmrg		pointer /*pglyphBase*/);
25805b261ecSmrg
25905b261ecSmrg    void	(* PushPixels)(
26005b261ecSmrg		GCPtr /*pGC*/,
26105b261ecSmrg		PixmapPtr /*pBitMap*/,
26205b261ecSmrg		DrawablePtr /*pDst*/,
26305b261ecSmrg		int /*w*/,
26405b261ecSmrg		int /*h*/,
26505b261ecSmrg		int /*x*/,
26605b261ecSmrg		int /*y*/);
26705b261ecSmrg
26805b261ecSmrg    DevUnion	devPrivate;
26905b261ecSmrg} GCOps;
27005b261ecSmrg
27105b261ecSmrg/* there is padding in the bit fields because the Sun compiler doesn't
27205b261ecSmrg * force alignment to 32-bit boundaries.  losers.
27305b261ecSmrg */
27405b261ecSmrgtypedef struct _GC {
27505b261ecSmrg    ScreenPtr		pScreen;
27605b261ecSmrg    unsigned char	depth;
27705b261ecSmrg    unsigned char	alu;
27805b261ecSmrg    unsigned short	lineWidth;
27905b261ecSmrg    unsigned short	dashOffset;
28005b261ecSmrg    unsigned short	numInDashList;
28105b261ecSmrg    unsigned char	*dash;
28205b261ecSmrg    unsigned int	lineStyle : 2;
28305b261ecSmrg    unsigned int	capStyle : 2;
28405b261ecSmrg    unsigned int	joinStyle : 2;
28505b261ecSmrg    unsigned int	fillStyle : 2;
28605b261ecSmrg    unsigned int	fillRule : 1;
28705b261ecSmrg    unsigned int 	arcMode : 1;
28805b261ecSmrg    unsigned int	subWindowMode : 1;
28905b261ecSmrg    unsigned int	graphicsExposures : 1;
29005b261ecSmrg    unsigned int	clientClipType : 2; /* CT_<kind> */
29105b261ecSmrg    unsigned int	miTranslate:1; /* should mi things translate? */
29205b261ecSmrg    unsigned int	tileIsPixel:1; /* tile is solid pixel */
29305b261ecSmrg    unsigned int	fExpose:1;     /* Call exposure handling */
29405b261ecSmrg    unsigned int	freeCompClip:1;  /* Free composite clip */
2956747b715Smrg    unsigned int	scratch_inuse:1; /* is this GC in a pool for reuse? */
2966747b715Smrg    unsigned int	unused:13; /* see comment above */
29705b261ecSmrg    unsigned long	planemask;
29805b261ecSmrg    unsigned long	fgPixel;
29905b261ecSmrg    unsigned long	bgPixel;
30005b261ecSmrg    /*
30105b261ecSmrg     * alas -- both tile and stipple must be here as they
30205b261ecSmrg     * are independently specifiable
30305b261ecSmrg     */
30405b261ecSmrg    PixUnion		tile;
30505b261ecSmrg    PixmapPtr		stipple;
30605b261ecSmrg    DDXPointRec		patOrg;		/* origin for (tile, stipple) */
30705b261ecSmrg    struct _Font	*font;
30805b261ecSmrg    DDXPointRec		clipOrg;
30905b261ecSmrg    DDXPointRec		lastWinOrg;	/* position of window last validated */
31005b261ecSmrg    pointer		clientClip;
31105b261ecSmrg    unsigned long	stateChanges;	/* masked with GC_<kind> */
31205b261ecSmrg    unsigned long       serialNumber;
31305b261ecSmrg    GCFuncs		*funcs;
31405b261ecSmrg    GCOps		*ops;
3154642e01fSmrg    PrivateRec		*devPrivates;
31605b261ecSmrg    /*
31705b261ecSmrg     * The following were moved here from private storage to allow device-
31805b261ecSmrg     * independent access to them from screen wrappers.
31905b261ecSmrg     * --- 1997.11.03  Marc Aurele La France (tsi@xfree86.org)
32005b261ecSmrg     */
32105b261ecSmrg    PixmapPtr		pRotatedPixmap; /* tile/stipple rotated for alignment */
32205b261ecSmrg    RegionPtr		pCompositeClip;
32305b261ecSmrg    /* fExpose & freeCompClip defined above */
32405b261ecSmrg} GC;
32505b261ecSmrg
32605b261ecSmrg#endif /* GCSTRUCT_H */
327