diff options
author | Michel Dänzer <michel@tungstengraphics.com> | 2008-02-15 00:01:32 +0000 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2008-02-15 00:01:32 +0000 |
commit | 005e31d3de04e7003f84a94d30f2b75a9636266e (patch) | |
tree | 2043113be09afd56b6f94b8ff9f58817478ed250 /GL | |
parent | cd78f0d0fc08e4e2339ed09dad1a12802de7729c (diff) |
AIGLX: Refactor code common between __glXDRI{drawableDestroy,releaseTexImage}.
Diffstat (limited to 'GL')
-rw-r--r-- | GL/glx/glxdri.c | 101 |
1 files changed, 38 insertions, 63 deletions
diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c index e405ee06f..304fed2bd 100644 --- a/GL/glx/glxdri.c +++ b/GL/glx/glxdri.c @@ -180,46 +180,53 @@ __glXDRIenterServer(GLboolean rendering) DRIWakeupHandler(NULL, 0, NULL); } + static void -__glXDRIdrawableDestroy(__GLXdrawable *drawable) +__glXDRIdoReleaseTexImage(__GLXDRIscreen *screen, __GLXDRIdrawable *drawable) { - __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; + GLuint lastOverride = screen->lastTexOffsetOverride; - int i; + if (lastOverride) { + __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride; + int i; - for (i = 0; i < screenInfo.numScreens; i++) { - __GLXDRIscreen * const screen = (__GLXDRIscreen *) - glxGetScreen(screenInfo.screens[i]); + for (i = 0; i < lastOverride; i++) { + if (texOffsetOverride[i] == drawable) { - GLuint lastOverride = screen->lastTexOffsetOverride; + texOffsetOverride[i] = NULL; - if (lastOverride) { - __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride; - int i; - - for (i = 0; i < lastOverride; i++) { - if (texOffsetOverride[i] == private) { - - texOffsetOverride[i] = NULL; - - if (i + 1 == lastOverride) { - lastOverride = 0; - - while (i--) { - if (texOffsetOverride[i]) { - lastOverride = i + 1; - break; - } + if (i + 1 == lastOverride) { + lastOverride = 0; + + while (i--) { + if (texOffsetOverride[i]) { + lastOverride = i + 1; + break; } - - screen->lastTexOffsetOverride = lastOverride; - - break; } + + screen->lastTexOffsetOverride = lastOverride; + + break; } } } } +} + + +static void +__glXDRIdrawableDestroy(__GLXdrawable *drawable) +{ + __GLXDRIdrawable *private = (__GLXDRIdrawable *) drawable; + + int i; + + for (i = 0; i < screenInfo.numScreens; i++) { + __glXDRIdoReleaseTexImage((__GLXDRIscreen *) + glxGetScreen(screenInfo.screens[i]), + private); + } (*private->driDrawable.destroyDrawable)(&private->driDrawable); @@ -561,41 +568,9 @@ __glXDRIreleaseTexImage(__GLXcontext *baseContext, int buffer, __GLXdrawable *pixmap) { - ScreenPtr pScreen = pixmap->pDraw->pScreen; - __GLXDRIdrawable *driDraw = - containerOf(pixmap, __GLXDRIdrawable, base); - __GLXDRIscreen * const screen = - (__GLXDRIscreen *) glxGetScreen(pScreen); - GLuint lastOverride = screen->lastTexOffsetOverride; - - if (lastOverride) { - __GLXDRIdrawable **texOffsetOverride = screen->texOffsetOverride; - int i; - - for (i = 0; i < lastOverride; i++) { - if (texOffsetOverride[i] == driDraw) { - if (screen->texOffsetFinish) - screen->texOffsetFinish((PixmapPtr)pixmap->pDraw); - - texOffsetOverride[i] = NULL; - - if (i + 1 == lastOverride) { - lastOverride = 0; - - while (i--) { - if (texOffsetOverride[i]) { - lastOverride = i + 1; - break; - } - } - - screen->lastTexOffsetOverride = lastOverride; - - break; - } - } - } - } + __glXDRIdoReleaseTexImage((__GLXDRIscreen *) + glxGetScreen(pixmap->pDraw->pScreen), + containerOf(pixmap, __GLXDRIdrawable, base)); return Success; } |