aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/gc.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-06-08 09:33:13 +0200
committermarha <marha@users.sourceforge.net>2012-06-08 09:33:13 +0200
commit990bc3f015a4f8fce2eb918375defcd44980a845 (patch)
tree8e8301f19482b52cc00bd95b4593522cc93267af /xorg-server/dix/gc.c
parent1af6fc1b5d93e54d6674de8b5870448b29f139a7 (diff)
downloadvcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.tar.gz
vcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.tar.bz2
vcxsrv-990bc3f015a4f8fce2eb918375defcd44980a845.zip
Used synchronise script to update files
Diffstat (limited to 'xorg-server/dix/gc.c')
-rw-r--r--xorg-server/dix/gc.c110
1 files changed, 46 insertions, 64 deletions
diff --git a/xorg-server/dix/gc.c b/xorg-server/dix/gc.c
index 7be050221..ac67643cf 100644
--- a/xorg-server/dix/gc.c
+++ b/xorg-server/dix/gc.c
@@ -458,32 +458,21 @@ ChangeGCXIDs(ClientPtr client, GC * pGC, BITS32 mask, CARD32 *pC32)
return ChangeGC(client, pGC, mask, vals);
}
-/* CreateGC(pDrawable, mask, pval, pStatus)
- creates a default GC for the given drawable, using mask to fill
- in any non-default values.
- Returns a pointer to the new GC on success, NULL otherwise.
- returns status of non-default fields in pStatus
-BUG:
- should check for failure to create default tile
-
-*/
-GCPtr
-CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
- XID gcid, ClientPtr client)
+static GCPtr
+NewGCObject(ScreenPtr pScreen, int depth)
{
GCPtr pGC;
pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC);
if (!pGC) {
- *pStatus = BadAlloc;
return (GCPtr) NULL;
}
- pGC->pScreen = pDrawable->pScreen;
- pGC->depth = pDrawable->depth;
+ pGC->pScreen = pScreen;
+ pGC->depth = depth;
pGC->alu = GXcopy; /* dst <- src */
pGC->planemask = ~0;
- pGC->serialNumber = GC_CHANGE_SERIAL_BIT;
+ pGC->serialNumber = 0;
pGC->funcs = 0;
pGC->fgPixel = 0;
pGC->bgPixel = 1;
@@ -496,17 +485,8 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
pGC->arcMode = ArcPieSlice;
pGC->tile.pixel = 0;
pGC->tile.pixmap = NullPixmap;
- if (mask & GCForeground) {
- /*
- * magic special case -- ChangeGC checks for this condition
- * and snags the Foreground value to create a pseudo default-tile
- */
- pGC->tileIsPixel = FALSE;
- }
- else {
- pGC->tileIsPixel = TRUE;
- }
+ pGC->tileIsPixel = TRUE;
pGC->patOrg.x = 0;
pGC->patOrg.y = 0;
pGC->subWindowMode = ClipByChildren;
@@ -521,12 +501,49 @@ CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
/* use the default font and stipple */
pGC->font = defaultFont;
- defaultFont->refcnt++;
+ if (pGC->font) /* necessary, because open of default font could fail */
+ pGC->font->refcnt++;
pGC->stipple = pGC->pScreen->PixmapPerDepth[0];
- pGC->stipple->refcnt++;
+ if (pGC->stipple)
+ pGC->stipple->refcnt++;
/* this is not a scratch GC */
pGC->scratch_inuse = FALSE;
+ return pGC;
+}
+
+/* CreateGC(pDrawable, mask, pval, pStatus)
+ creates a default GC for the given drawable, using mask to fill
+ in any non-default values.
+ Returns a pointer to the new GC on success, NULL otherwise.
+ returns status of non-default fields in pStatus
+BUG:
+ should check for failure to create default tile
+
+*/
+GCPtr
+CreateGC(DrawablePtr pDrawable, BITS32 mask, XID *pval, int *pStatus,
+ XID gcid, ClientPtr client)
+{
+ GCPtr pGC;
+
+ pGC = NewGCObject(pDrawable->pScreen, pDrawable->depth);
+ if (!pGC) {
+ *pStatus = BadAlloc;
+ return (GCPtr) NULL;
+ }
+
+ pGC->serialNumber = GC_CHANGE_SERIAL_BIT;
+ if (mask & GCForeground) {
+ /*
+ * magic special case -- ChangeGC checks for this condition
+ * and snags the Foreground value to create a pseudo default-tile
+ */
+ pGC->tileIsPixel = FALSE;
+ }
+ else {
+ pGC->tileIsPixel = TRUE;
+ }
/* security creation/labeling check */
*pStatus = XaceHook(XACE_RESOURCE_ACCESS, client, gcid, RT_GC, pGC,
@@ -784,45 +801,10 @@ CreateScratchGC(ScreenPtr pScreen, unsigned depth)
{
GCPtr pGC;
- pGC = dixAllocateObjectWithPrivates(GC, PRIVATE_GC);
+ pGC = NewGCObject(pScreen, depth);
if (!pGC)
return (GCPtr) NULL;
- pGC->pScreen = pScreen;
- pGC->depth = depth;
- pGC->alu = GXcopy; /* dst <- src */
- pGC->planemask = ~0;
- pGC->serialNumber = 0;
- pGC->fgPixel = 0;
- pGC->bgPixel = 1;
- pGC->lineWidth = 0;
- pGC->lineStyle = LineSolid;
- pGC->capStyle = CapButt;
- pGC->joinStyle = JoinMiter;
- pGC->fillStyle = FillSolid;
- pGC->fillRule = EvenOddRule;
- pGC->arcMode = ArcPieSlice;
- pGC->font = defaultFont;
- if (pGC->font) /* necessary, because open of default font could fail */
- pGC->font->refcnt++;
- pGC->tileIsPixel = TRUE;
- pGC->tile.pixel = 0;
- pGC->tile.pixmap = NullPixmap;
- pGC->stipple = NullPixmap;
- pGC->patOrg.x = 0;
- pGC->patOrg.y = 0;
- pGC->subWindowMode = ClipByChildren;
- pGC->graphicsExposures = TRUE;
- pGC->clipOrg.x = 0;
- pGC->clipOrg.y = 0;
- pGC->clientClipType = CT_NONE;
- pGC->dashOffset = 0;
- pGC->numInDashList = 2;
- pGC->dash = DefaultDash;
-
- /* scratch GCs in the GCperDepth pool start off unused */
- pGC->scratch_inuse = FALSE;
-
pGC->stateChanges = GCAllBits;
if (!(*pScreen->CreateGC) (pGC)) {
FreeGC(pGC, (XID) 0);