gcstruct.h revision 706f2543
1706f2543Smrg/*********************************************************** 2706f2543Smrg 3706f2543SmrgCopyright 1987, 1998 The Open Group 4706f2543Smrg 5706f2543SmrgPermission to use, copy, modify, distribute, and sell this software and its 6706f2543Smrgdocumentation for any purpose is hereby granted without fee, provided that 7706f2543Smrgthe above copyright notice appear in all copies and that both that 8706f2543Smrgcopyright notice and this permission notice appear in supporting 9706f2543Smrgdocumentation. 10706f2543Smrg 11706f2543SmrgThe above copyright notice and this permission notice shall be included in 12706f2543Smrgall copies or substantial portions of the Software. 13706f2543Smrg 14706f2543SmrgTHE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15706f2543SmrgIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16706f2543SmrgFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17706f2543SmrgOPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 18706f2543SmrgAN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 19706f2543SmrgCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 20706f2543Smrg 21706f2543SmrgExcept as contained in this notice, the name of The Open Group shall not be 22706f2543Smrgused in advertising or otherwise to promote the sale, use or other dealings 23706f2543Smrgin this Software without prior written authorization from The Open Group. 24706f2543Smrg 25706f2543Smrg 26706f2543SmrgCopyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. 27706f2543Smrg 28706f2543Smrg All Rights Reserved 29706f2543Smrg 30706f2543SmrgPermission to use, copy, modify, and distribute this software and its 31706f2543Smrgdocumentation for any purpose and without fee is hereby granted, 32706f2543Smrgprovided that the above copyright notice appear in all copies and that 33706f2543Smrgboth that copyright notice and this permission notice appear in 34706f2543Smrgsupporting documentation, and that the name of Digital not be 35706f2543Smrgused in advertising or publicity pertaining to distribution of the 36706f2543Smrgsoftware without specific, written prior permission. 37706f2543Smrg 38706f2543SmrgDIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 39706f2543SmrgALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 40706f2543SmrgDIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 41706f2543SmrgANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 42706f2543SmrgWHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 43706f2543SmrgARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 44706f2543SmrgSOFTWARE. 45706f2543Smrg 46706f2543Smrg******************************************************************/ 47706f2543Smrg 48706f2543Smrg 49706f2543Smrg 50706f2543Smrg#ifndef GCSTRUCT_H 51706f2543Smrg#define GCSTRUCT_H 52706f2543Smrg 53706f2543Smrg#include "gc.h" 54706f2543Smrg 55706f2543Smrg#include "regionstr.h" 56706f2543Smrg#include "region.h" 57706f2543Smrg#include "pixmap.h" 58706f2543Smrg#include "screenint.h" 59706f2543Smrg#include "privates.h" 60706f2543Smrg#include <X11/Xprotostr.h> 61706f2543Smrg 62706f2543Smrg#define GCAllBits ((1 << (GCLastBit + 1)) - 1) 63706f2543Smrg 64706f2543Smrg/* 65706f2543Smrg * functions which modify the state of the GC 66706f2543Smrg */ 67706f2543Smrg 68706f2543Smrgtypedef struct _GCFuncs { 69706f2543Smrg void (* ValidateGC)( 70706f2543Smrg GCPtr /*pGC*/, 71706f2543Smrg unsigned long /*stateChanges*/, 72706f2543Smrg DrawablePtr /*pDrawable*/); 73706f2543Smrg 74706f2543Smrg void (* ChangeGC)( 75706f2543Smrg GCPtr /*pGC*/, 76706f2543Smrg unsigned long /*mask*/); 77706f2543Smrg 78706f2543Smrg void (* CopyGC)( 79706f2543Smrg GCPtr /*pGCSrc*/, 80706f2543Smrg unsigned long /*mask*/, 81706f2543Smrg GCPtr /*pGCDst*/); 82706f2543Smrg 83706f2543Smrg void (* DestroyGC)( 84706f2543Smrg GCPtr /*pGC*/); 85706f2543Smrg 86706f2543Smrg void (* ChangeClip)( 87706f2543Smrg GCPtr /*pGC*/, 88706f2543Smrg int /*type*/, 89706f2543Smrg pointer /*pvalue*/, 90706f2543Smrg int /*nrects*/); 91706f2543Smrg 92706f2543Smrg void (* DestroyClip)( 93706f2543Smrg GCPtr /*pGC*/); 94706f2543Smrg 95706f2543Smrg void (* CopyClip)( 96706f2543Smrg GCPtr /*pgcDst*/, 97706f2543Smrg GCPtr /*pgcSrc*/); 98706f2543Smrg} GCFuncs; 99706f2543Smrg 100706f2543Smrg/* 101706f2543Smrg * graphics operations invoked through a GC 102706f2543Smrg */ 103706f2543Smrg 104706f2543Smrgtypedef struct _GCOps { 105706f2543Smrg void (* FillSpans)( 106706f2543Smrg DrawablePtr /*pDrawable*/, 107706f2543Smrg GCPtr /*pGC*/, 108706f2543Smrg int /*nInit*/, 109706f2543Smrg DDXPointPtr /*pptInit*/, 110706f2543Smrg int * /*pwidthInit*/, 111706f2543Smrg int /*fSorted*/); 112706f2543Smrg 113706f2543Smrg void (* SetSpans)( 114706f2543Smrg DrawablePtr /*pDrawable*/, 115706f2543Smrg GCPtr /*pGC*/, 116706f2543Smrg char * /*psrc*/, 117706f2543Smrg DDXPointPtr /*ppt*/, 118706f2543Smrg int * /*pwidth*/, 119706f2543Smrg int /*nspans*/, 120706f2543Smrg int /*fSorted*/); 121706f2543Smrg 122706f2543Smrg void (* PutImage)( 123706f2543Smrg DrawablePtr /*pDrawable*/, 124706f2543Smrg GCPtr /*pGC*/, 125706f2543Smrg int /*depth*/, 126706f2543Smrg int /*x*/, 127706f2543Smrg int /*y*/, 128706f2543Smrg int /*w*/, 129706f2543Smrg int /*h*/, 130706f2543Smrg int /*leftPad*/, 131706f2543Smrg int /*format*/, 132706f2543Smrg char * /*pBits*/); 133706f2543Smrg 134706f2543Smrg RegionPtr (* CopyArea)( 135706f2543Smrg DrawablePtr /*pSrc*/, 136706f2543Smrg DrawablePtr /*pDst*/, 137706f2543Smrg GCPtr /*pGC*/, 138706f2543Smrg int /*srcx*/, 139706f2543Smrg int /*srcy*/, 140706f2543Smrg int /*w*/, 141706f2543Smrg int /*h*/, 142706f2543Smrg int /*dstx*/, 143706f2543Smrg int /*dsty*/); 144706f2543Smrg 145706f2543Smrg RegionPtr (* CopyPlane)( 146706f2543Smrg DrawablePtr /*pSrcDrawable*/, 147706f2543Smrg DrawablePtr /*pDstDrawable*/, 148706f2543Smrg GCPtr /*pGC*/, 149706f2543Smrg int /*srcx*/, 150706f2543Smrg int /*srcy*/, 151706f2543Smrg int /*width*/, 152706f2543Smrg int /*height*/, 153706f2543Smrg int /*dstx*/, 154706f2543Smrg int /*dsty*/, 155706f2543Smrg unsigned long /*bitPlane*/); 156706f2543Smrg void (* PolyPoint)( 157706f2543Smrg DrawablePtr /*pDrawable*/, 158706f2543Smrg GCPtr /*pGC*/, 159706f2543Smrg int /*mode*/, 160706f2543Smrg int /*npt*/, 161706f2543Smrg DDXPointPtr /*pptInit*/); 162706f2543Smrg 163706f2543Smrg void (* Polylines)( 164706f2543Smrg DrawablePtr /*pDrawable*/, 165706f2543Smrg GCPtr /*pGC*/, 166706f2543Smrg int /*mode*/, 167706f2543Smrg int /*npt*/, 168706f2543Smrg DDXPointPtr /*pptInit*/); 169706f2543Smrg 170706f2543Smrg void (* PolySegment)( 171706f2543Smrg DrawablePtr /*pDrawable*/, 172706f2543Smrg GCPtr /*pGC*/, 173706f2543Smrg int /*nseg*/, 174706f2543Smrg xSegment * /*pSegs*/); 175706f2543Smrg 176706f2543Smrg void (* PolyRectangle)( 177706f2543Smrg DrawablePtr /*pDrawable*/, 178706f2543Smrg GCPtr /*pGC*/, 179706f2543Smrg int /*nrects*/, 180706f2543Smrg xRectangle * /*pRects*/); 181706f2543Smrg 182706f2543Smrg void (* PolyArc)( 183706f2543Smrg DrawablePtr /*pDrawable*/, 184706f2543Smrg GCPtr /*pGC*/, 185706f2543Smrg int /*narcs*/, 186706f2543Smrg xArc * /*parcs*/); 187706f2543Smrg 188706f2543Smrg void (* FillPolygon)( 189706f2543Smrg DrawablePtr /*pDrawable*/, 190706f2543Smrg GCPtr /*pGC*/, 191706f2543Smrg int /*shape*/, 192706f2543Smrg int /*mode*/, 193706f2543Smrg int /*count*/, 194706f2543Smrg DDXPointPtr /*pPts*/); 195706f2543Smrg 196706f2543Smrg void (* PolyFillRect)( 197706f2543Smrg DrawablePtr /*pDrawable*/, 198706f2543Smrg GCPtr /*pGC*/, 199706f2543Smrg int /*nrectFill*/, 200706f2543Smrg xRectangle * /*prectInit*/); 201706f2543Smrg 202706f2543Smrg void (* PolyFillArc)( 203706f2543Smrg DrawablePtr /*pDrawable*/, 204706f2543Smrg GCPtr /*pGC*/, 205706f2543Smrg int /*narcs*/, 206706f2543Smrg xArc * /*parcs*/); 207706f2543Smrg 208706f2543Smrg int (* PolyText8)( 209706f2543Smrg DrawablePtr /*pDrawable*/, 210706f2543Smrg GCPtr /*pGC*/, 211706f2543Smrg int /*x*/, 212706f2543Smrg int /*y*/, 213706f2543Smrg int /*count*/, 214706f2543Smrg char * /*chars*/); 215706f2543Smrg 216706f2543Smrg int (* PolyText16)( 217706f2543Smrg DrawablePtr /*pDrawable*/, 218706f2543Smrg GCPtr /*pGC*/, 219706f2543Smrg int /*x*/, 220706f2543Smrg int /*y*/, 221706f2543Smrg int /*count*/, 222706f2543Smrg unsigned short * /*chars*/); 223706f2543Smrg 224706f2543Smrg void (* ImageText8)( 225706f2543Smrg DrawablePtr /*pDrawable*/, 226706f2543Smrg GCPtr /*pGC*/, 227706f2543Smrg int /*x*/, 228706f2543Smrg int /*y*/, 229706f2543Smrg int /*count*/, 230706f2543Smrg char * /*chars*/); 231706f2543Smrg 232706f2543Smrg void (* ImageText16)( 233706f2543Smrg DrawablePtr /*pDrawable*/, 234706f2543Smrg GCPtr /*pGC*/, 235706f2543Smrg int /*x*/, 236706f2543Smrg int /*y*/, 237706f2543Smrg int /*count*/, 238706f2543Smrg unsigned short * /*chars*/); 239706f2543Smrg 240706f2543Smrg void (* ImageGlyphBlt)( 241706f2543Smrg DrawablePtr /*pDrawable*/, 242706f2543Smrg GCPtr /*pGC*/, 243706f2543Smrg int /*x*/, 244706f2543Smrg int /*y*/, 245706f2543Smrg unsigned int /*nglyph*/, 246706f2543Smrg CharInfoPtr * /*ppci*/, 247706f2543Smrg pointer /*pglyphBase*/); 248706f2543Smrg 249706f2543Smrg void (* PolyGlyphBlt)( 250706f2543Smrg DrawablePtr /*pDrawable*/, 251706f2543Smrg GCPtr /*pGC*/, 252706f2543Smrg int /*x*/, 253706f2543Smrg int /*y*/, 254706f2543Smrg unsigned int /*nglyph*/, 255706f2543Smrg CharInfoPtr * /*ppci*/, 256706f2543Smrg pointer /*pglyphBase*/); 257706f2543Smrg 258706f2543Smrg void (* PushPixels)( 259706f2543Smrg GCPtr /*pGC*/, 260706f2543Smrg PixmapPtr /*pBitMap*/, 261706f2543Smrg DrawablePtr /*pDst*/, 262706f2543Smrg int /*w*/, 263706f2543Smrg int /*h*/, 264706f2543Smrg int /*x*/, 265706f2543Smrg int /*y*/); 266706f2543Smrg} GCOps; 267706f2543Smrg 268706f2543Smrg/* there is padding in the bit fields because the Sun compiler doesn't 269706f2543Smrg * force alignment to 32-bit boundaries. losers. 270706f2543Smrg */ 271706f2543Smrgtypedef struct _GC { 272706f2543Smrg ScreenPtr pScreen; 273706f2543Smrg unsigned char depth; 274706f2543Smrg unsigned char alu; 275706f2543Smrg unsigned short lineWidth; 276706f2543Smrg unsigned short dashOffset; 277706f2543Smrg unsigned short numInDashList; 278706f2543Smrg unsigned char *dash; 279706f2543Smrg unsigned int lineStyle : 2; 280706f2543Smrg unsigned int capStyle : 2; 281706f2543Smrg unsigned int joinStyle : 2; 282706f2543Smrg unsigned int fillStyle : 2; 283706f2543Smrg unsigned int fillRule : 1; 284706f2543Smrg unsigned int arcMode : 1; 285706f2543Smrg unsigned int subWindowMode : 1; 286706f2543Smrg unsigned int graphicsExposures : 1; 287706f2543Smrg unsigned int clientClipType : 2; /* CT_<kind> */ 288706f2543Smrg unsigned int miTranslate:1; /* should mi things translate? */ 289706f2543Smrg unsigned int tileIsPixel:1; /* tile is solid pixel */ 290706f2543Smrg unsigned int fExpose:1; /* Call exposure handling */ 291706f2543Smrg unsigned int freeCompClip:1; /* Free composite clip */ 292706f2543Smrg unsigned int scratch_inuse:1; /* is this GC in a pool for reuse? */ 293706f2543Smrg unsigned int unused:13; /* see comment above */ 294706f2543Smrg unsigned long planemask; 295706f2543Smrg unsigned long fgPixel; 296706f2543Smrg unsigned long bgPixel; 297706f2543Smrg /* 298706f2543Smrg * alas -- both tile and stipple must be here as they 299706f2543Smrg * are independently specifiable 300706f2543Smrg */ 301706f2543Smrg PixUnion tile; 302706f2543Smrg PixmapPtr stipple; 303706f2543Smrg DDXPointRec patOrg; /* origin for (tile, stipple) */ 304706f2543Smrg struct _Font *font; 305706f2543Smrg DDXPointRec clipOrg; 306706f2543Smrg pointer clientClip; 307706f2543Smrg unsigned long stateChanges; /* masked with GC_<kind> */ 308706f2543Smrg unsigned long serialNumber; 309706f2543Smrg GCFuncs *funcs; 310706f2543Smrg GCOps *ops; 311706f2543Smrg PrivateRec *devPrivates; 312706f2543Smrg /* 313706f2543Smrg * The following were moved here from private storage to allow device- 314706f2543Smrg * independent access to them from screen wrappers. 315706f2543Smrg * --- 1997.11.03 Marc Aurele La France (tsi@xfree86.org) 316706f2543Smrg */ 317706f2543Smrg PixmapPtr pRotatedPixmap; /* tile/stipple rotated for alignment */ 318706f2543Smrg RegionPtr pCompositeClip; 319706f2543Smrg /* fExpose & freeCompClip defined above */ 320706f2543Smrg} GC; 321706f2543Smrg 322706f2543Smrg#endif /* GCSTRUCT_H */ 323