[PATCH 1/2] glxdriswrast: Use CreateGC, not CreateScratchGC.
Jamey Sharp
jamey at minilop.net
Wed May 19 15:25:43 PDT 2010
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 at minilop.net>
Cc: Kristian Høgsberg <krh at bitplanet.net>
---
glx/glxdriswrast.c | 20 ++++++++------------
1 files changed, 8 insertions(+), 12 deletions(-)
diff --git a/glx/glxdriswrast.c b/glx/glxdriswrast.c
index 54f4440..dc12f57 100644
--- a/glx/glxdriswrast.c
+++ b/glx/glxdriswrast.c
@@ -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,
--
1.7.0
More information about the xorg-devel
mailing list