glxdriswrast: Use CreateGC, not CreateScratchGC.

Since this code was using CreateScratchGC and not GetScratchGC,
FreeScratchGC would always call FreeGC, so just call it directly.

As long as the drawable provided to CreateGC has the same screen and
depth as were passed to CreateScratchGC, these functions are basically
identical. There are two differences:

- CreateGC gives you a non-null stipple. You probably don't care.

- CreateGC passes the gcid and client to XACE. There are several
  internal GCs allocated in the server, and they all pass 0 and
  serverClient. I expect XACE will never reject that combination.

The callers of createDrawable all verify that pDraw has the same screen
that driScreen does. In short, this should have no behavioral change.

Signed-off-by: Jamey Sharp <jamey@minilop.net>
Cc: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Jamey Sharp 2010-05-19 14:03:19 -07:00
parent af2a94e12f
commit 0f48e362c5

View File

@ -99,8 +99,8 @@ __glXDRIdrawableDestroy(__GLXdrawable *drawable)
(*core->destroyDrawable)(private->driDrawable);
FreeScratchGC(private->gc);
FreeScratchGC(private->swapgc);
FreeGC(private->gc, (GContext)0);
FreeGC(private->swapgc, (GContext)0);
__glXDrawableRelease(drawable);
@ -301,13 +301,12 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
XID glxDrawId,
__GLXconfig *glxConfig)
{
ChangeGCVal gcvals[2];
XID gcvals[2];
int status;
__GLXDRIscreen *driScreen = (__GLXDRIscreen *) screen;
__GLXDRIconfig *config = (__GLXDRIconfig *) glxConfig;
__GLXDRIdrawable *private;
ScreenPtr pScreen = driScreen->base.pScreen;
private = calloc(1, sizeof *private);
if (private == NULL)
return NULL;
@ -323,13 +322,10 @@ __glXDRIscreenCreateDrawable(ClientPtr client,
private->base.swapBuffers = __glXDRIdrawableSwapBuffers;
private->base.copySubBuffer = __glXDRIdrawableCopySubBuffer;
private->gc = CreateScratchGC(pScreen, pDraw->depth);
private->swapgc = CreateScratchGC(pScreen, pDraw->depth);
gcvals[0].val = GXcopy;
ChangeGC(NullClient, private->gc, GCFunction, gcvals);
gcvals[1].val = FALSE;
ChangeGC(NullClient, private->swapgc, GCFunction | GCGraphicsExposures, gcvals);
gcvals[0] = GXcopy;
private->gc = CreateGC(pDraw, GCFunction, gcvals, &status, (XID)0, serverClient);
gcvals[1] = FALSE;
private->swapgc = CreateGC(pDraw, GCFunction | GCGraphicsExposures, gcvals, &status, (XID)0, serverClient);
private->driDrawable =
(*driScreen->swrast->createNewDrawable)(driScreen->driScreen,